React carousel components

8 carousel componentsLive previewFull source in your repo

Swipeable rails, card decks and infinite marquees, each with keyboard stepping and snap already handled. Install one and the source is yours to change.

Works with

  • React
  • Next.js
  • TypeScript
  • Tailwind CSS

React carousels and 3D carousels

From a standard accessible carousel to a cylindrical photo rail with inertia. Each ships with pointer, keyboard and touch input already wired.

Infinite marquees and logo sliders

Not everything that moves sideways needs arrows. These loop on their own, for logos and other content that is a texture rather than a list.

Range and comparison sliders

The other two things a React slider can mean: a range input for picking a value, and a handle you drag to wipe between a before and an after image.

When the content is a sequence the page should walk through, scroll can do the stepping: cards that stack as you scroll, a pinned frame sequence, a video scrubbed by the scrollbar, and animated tabs.

Galleries that move without being a carousel: a fanned card stack, a hover row, a throwable photo collage, and cards that expand on hover.

A carousel shows a set of items one or a few at a time and lets the visitor step through the rest. A slider usually means the same thing in a React context, though the word also covers range inputs, so this page lists both. The pattern has a bad reputation and most of it is earned: an auto rotating hero carousel of marketing messages gets ignored, because people learn to skip anything that moves on its own and only the first slide is ever really seen.

A carousel works when the items are equivalent and the visitor is browsing rather than being sold to. Product images, gallery photos, testimonials and logos fit that description. A row of feature explanations does not, because hiding four of five behind an arrow means most people read one. The test is simple: if you would be unhappy for someone to see only the first item, do not put it in a carousel.

The interaction model is the next choice. The base Carousel is the predictable one, with arrows, dots, looping, autoplay and keyboard stepping, and it is the easiest to make accessible. Tinder-Style Swipe Cards is better on touch and weaker with a mouse. Orbital Image Carousel is a drag rail with inertia that feels the best of the three and asks the most of the user, because nothing on screen says drag me until they try.

A 3D carousel trades predictability for presence. Cover Flow Carousel swings side covers into the centre in CSS 3D, 3D Image Carousel lines portrait cards along the inside of a curved wall that turns as you drag, and Card Stack Carousel drops the front card away and promotes the rest of the deck. Use one where the gallery is the product, such as an album, a portfolio or a lookbook, and use the flat carousel everywhere else.

Autoplay deserves more thought than it gets. If a carousel moves without being asked, it has to pause on hover, pause on keyboard focus, and stop for good once the user interacts, otherwise it pulls a slide away mid read. It also has to stop advancing when the visitor has asked for reduced motion. An infinite marquee is the one place continuous motion is fine, because the logos in it are a texture and nobody is trying to read a particular one.

Most React carousel libraries, Embla, Swiper and Slick among them, give you an engine and leave the styling and markup to you. The carousels here go the other way: each is one file you own, built on Framer Motion, with the markup, the motion and the controls already written. That suits a team that wants to change how the carousel looks and moves without learning a plugin API.

The accessibility work is the part worth not rebuilding. A carousel needs arrow key stepping, a live region announcing the current slide, focus that never lands on an off screen item, and controls that are real buttons rather than styled divs. The off screen focus problem is the one most hand rolled carousels miss, because it only appears when you tab through the page instead of clicking.

Frequently asked questions

Run npx wensity@latest add carousel to copy the base carousel into your codebase, or use the slug of any other carousel on this page. The CLI installs what the component needs and matches your Tailwind theme. Every one of them is a single file you own afterwards, so changing the snap behaviour or the arrow styling is a normal code edit.

In most React libraries the words mean the same thing: a row of slides you step through. Slider can also mean a range input for picking a value, which is why this page lists the Slider primitive next to the carousels. Image Comparison Slider is a third meaning, a handle you drag to wipe between a before and an after image.

No. The base Carousel is built on Framer Motion and pulls in no carousel library, so there is no Embla, Swiper or Slick plugin to configure or upgrade. Looping, autoplay and keyboard stepping live in the one file the CLI copies into your project. If your app already ships Embla for another slider, you can keep it there and still use these for the galleries that need custom motion.

Not by themselves. The risk is that content inside a carousel is often loaded lazily or hidden in a way crawlers do not follow, so it never gets indexed. The carousels here keep every slide in the server rendered HTML and move them with CSS transforms rather than mounting and unmounting, which means the text is in the document whether or not the slide is currently visible.

Only if it is decorative. An autoplaying carousel has to pause on hover, pause on keyboard focus, and stop for good once someone interacts, or it will move a slide away while it is being read. It should also not advance at all when the user has asked for reduced motion. A logo marquee is a reasonable exception because nobody is trying to read a specific item in it.

A carousel has discrete slides the user steps through and a current position that matters. A marquee scrolls continuously, has no concept of a current item, and usually loops forever. Use a carousel when someone might want to go back to slide two, and a marquee when the content is a texture rather than a list.

Where to go next