Shows a row of slides that you swipe or move with buttons.
Ridge at first light
First light on the north ridge, 06:12
Tide pools
Low tide at the point, 11:40
The north face
The north face after the storm
Dunes after rain
Dunes after the rain, 17:05
Pine valley
The pine valley trail, 09:30
Lake at dusk
Dusk on the lake, 19:48
The CLI adds the files, packages, theme variables, and Tailwind plugin that this component uses. Before you run it, set up your project.
`opts` and `plugins` go straight to Embla. `useCarousel()` returns the Embla `api` and the selected index, so a plugin can drive its own controls.
CarouselOwns the index. Pass Embla options and plugins to opts and plugins.
CarouselViewportCarouselSlideRepeats
CarouselPreviousOptionalCarouselNextOptionalCarouselIndicatorsOptionalCarouselThumbnailsOptionalCarouselThumbnailRepeats
CarouselStatusOptional
useCarousel Returns the Embla api plus selectedIndex, snapCount, canScrollPrev, canScrollNext, scrollTo, scrollPrev, and scrollNext for a lightbox or a plugin control.
Set a basis-* class on each slide to show more than one.
Ridge cabin
Sierra Nevada
$180 / night
Tide house
Big Sur
$240 / night
North hut
Chamonix
$150 / night
Dune camp
Wadi Rum
$120 / night
Pine lodge
Black Forest
$165 / night
Lake house
Lake Bled
$210 / night
Pass the Embla Autoplay plugin in plugins, add a pause button, and set aria-live="off" on the viewport. Also install Button.
Sunrise on the ridge
A two-hour climb for the first light of the day.
Low tide at the point
Walk out to the pools an hour before the turn.
After the storm
Fresh snow on the north face by morning.
The pine valley trail
Eight shaded kilometers with one steep climb.
0 / 0
Also install Badge.
Ridge walks
12 routes
Coastal weekends
8 routes
Winter peaks
5 routes
Desert nights
4 routes
Forest trails
15 routes
شروق على القمة
جبال الألب
برك المد والجزر
ساحل كاليفورنيا
الوجه الشمالي
شامونيه
كثبان بعد المطر
وادي رم
وادي الصنوبر
الغابة السوداء
Set axis to "y" in opts and give the viewport a height.
Sunrise on the ridge
A two-hour climb for the first light of the day.
Low tide at the point
Walk out to the pools an hour before the turn.
After the storm
Fresh snow on the north face by morning.
Dusk on the lake
The water goes still for ten minutes after sunset.
Carousel
- aria-label: stringRequired
- Names the carousel region.
- index: number
- Sets the current slide. A change scrolls the viewport to that slide.
- defaultIndex: number = 0
- Sets the slide that shows first. `opts.startIndex` takes precedence.
- onIndexChange: (index: number) => void
- Receives the slide that becomes current from a swipe, a button, a plugin, or the keyboard.
- opts: CarouselOptions
- Embla options, such as `align`, `axis`, `loop`, `slidesToScroll`, and `dragFree`.
- plugins: CarouselPlugin[]
- Embla plugins, such as Autoplay, Auto Height, or Wheel Gestures. The carousel adds no plugin of its own.
- setApi: (api: CarouselApi) => void
- Receives the Embla API after mount. Call any Embla method from it.
CarouselViewport
The Embla viewport and its flex track. It takes focus, so the arrow keys move one slide, and it fades the edges that have more slides.
- trackClassName: string
- Adds classes to the inner flex track, such as a different gap or alignment.
CarouselSlide
- aria-label: string
- Names the slide. The default is the slide number and the total, such as 2 of 5.
CarouselPrevious
Renders an icon-only outline Button. It takes Button props and is disabled when no earlier slide is reachable.
CarouselNext
Renders an icon-only outline Button. It takes Button props and is disabled when no later slide is reachable.
CarouselIndicators
Shows one dot per scroll snap in a group named Slides. The current dot stretches.
CarouselThumbnails
Holds a row of thumbnail buttons.
CarouselThumbnail
- index: numberRequired
- Sets the slide that a press shows.
- aria-label: stringRequired
- Names the view that the thumbnail shows.
CarouselStatus
Shows the current slide as text, such as 2 / 5.