Carousel
A row of things to browse by swiping, dragging or pressing the arrows: photos, cards, featured content. Multi-browse and hero layouts, from Material 3, show one large item and let the rest shrink to a peek, so you can see there is more and still read what is in front of you.
Install
npx shadcn@latest add @nelumbo/carouselMulti-browse
layout="multi-browse": one large item, a medium one and small ones at the edge. The large item shrinks as it scrolls off while the next one grows, following your finger. Drag, swipe, press the arrows or use the dots.
Hero
layout="hero": one large item and a small peek of the next.
Uncontained
layout="uncontained": equal items that run off the edge. Item width comes from a basis class on CarouselItem (basis-[40%] by default).
Maya Kowalski
Product design
Kenji Watanabe
Motion and prototyping
Léa Martin
Design systems
Omar Haddad
Frontend
Sofía Ramírez
Platform
Tomás Novák
Research
Aisha Bello
Content design
Ravi Iyer
Data
Full and vertical
The default layout is "full": one item at a time, like shadcn. Vertical carousels need a height on CarouselContent. Arrow keys follow the axis.
Glacier lake
Iceland
Old town at dusk
Lisbon
Tea terraces
Fujian
Night market
Taipei
Salt flats
Bolivia
Harbour fog
Maine
Desert road
Namibia
Bamboo grove
Kyoto
Vertical multi-browse
Multi-browse and hero work on the vertical axis too.
Usage
import { Carousel, CarouselContent, CarouselItem, CarouselPrevious, CarouselNext, CarouselDots } from "@/components/ui/carousel"// shadcn's API<Carousel className="w-full max-w-xs"> <CarouselContent> <CarouselItem>…</CarouselItem> </CarouselContent> <CarouselPrevious /> <CarouselNext /></Carousel>// Nelumbo: Material 3 layouts and a dot indicator<Carousel layout="multi-browse" aria-label="Photos"> <CarouselContent className="h-72"> <CarouselItem> <Photo className="h-full w-full" /> </CarouselItem> </CarouselContent> <CarouselPrevious /> <CarouselNext /> <CarouselDots className="mt-3" /></Carousel>// Fade a label in as the card grows<p className="truncate" style={{ opacity: "calc((var(--carousel-p) - 0.6) * 2.5)" }}>Glacier lake</p>Props
| Prop | Type | Default | Embla's own props (opts, plugins, setApi, orientation) work as in shadcn |
|---|---|---|---|
Carousel layout | "full" | "uncontained" | "multi-browse" | "hero" | "full" | How items are sized. Full is shadcn's behaviour |
Carousel orientation | "horizontal" | "vertical" | "horizontal" | Vertical needs a height on CarouselContent |
Carousel opts / plugins / setApi | Embla options / plugins / callback | Passed through; setApi hands you the Embla API | |
CarouselContent className | string | Multi-browse and hero use h-64 unless you set a height | |
CarouselItem className | string | Uncontained: set the width with basis-* | |
CarouselPrevious / Next | IconButton props | Tonal icon buttons over the edges; hidden at the ends. label overrides the accessible name | |
CarouselDots | div props | One dot per scroll position; the active dot stretches into a pill | |
--carousel-p | CSS variable | Set on each multi-browse and hero card: 0 small to 1 large |