Command Palette

Search for a command to run...

Carousel

A carousel with motion and swipe built using Embla.

Installation

pnpm dlx shadcn@latest add https://dga-registry.vercel.app/r/carousel.json

Default

Basic carousel with navigation arrows.

1
2
3
4
5

Multiple Items

Show multiple slides at once using basis classes.

1
2
3
4
5

Vertical Orientation

Carousel with vertical scrolling.

1
2
3
4
5

Autoplay

Carousel with automatic slide advancement. Pauses on hover.

1
2
3
4
5

With API

Access the carousel API to display current slide state.

1
2
3
4
5
Slide 0 of 0

Custom Icons

Use different icons for the navigation buttons.

1
2
3
4
5

Props

ComponentPropTypeDefaultDescription
CarouseloptsEmblaOptionsTypeEmbla carousel options
CarouselpluginsEmblaPluginType[]Embla plugins (e.g., Autoplay)
Carouselorientation"horizontal" | "vertical""horizontal"Scroll direction
CarouselsetApi(api) => voidCallback to access carousel API
Carouseldir"ltr" | "rtl"Text direction for the carousel
CarouselItemclassNamestringBasis classes for sizing
CarouselPreviousvariantstring"outline"Button variant
CarouselPreviousiconHugeIconArrowLeft01IconCustom icon
CarouselNextvariantstring"outline"Button variant
CarouselNexticonHugeIconArrowRight01IconCustom icon

RTL Support

When localizing the carousel for RTL languages, set the direction option in opts to match the text direction. This ensures the carousel scrolls in the correct direction.

<Carousel dir={dir} opts={{ direction: dir }}>
  <CarouselContent>
    <CarouselItem>...</CarouselItem>
  </CarouselContent>
  <CarouselPrevious />
  <CarouselNext />
</Carousel>