Components
Carousel
A shadcn-style card carousel with swipeable slides and external next or previous controls.
Installation
Install the registry item directly, then add any package dependencies if you are setting the component up manually.
Install the component
Run the registry command below to add carousel to your project.
watermelon add carouselImport the component
Import Carousel from your local UI registry output.
Import
import { Carousel } from "@/components/ui/carousel";Import
Import
import {
Carousel,
CarouselContent,
CarouselItem,
CarouselNext,
CarouselPrevious,
} from "@/components/ui/carousel";Usage
Carousels work well for swipeable feature cards, onboarding steps, and compact content rails that still need clear external controls.
API Reference
| prop | type | default | description |
|---|---|---|---|
| defaultIndex / index | number | 0 | Sets the active slide in uncontrolled or controlled mode. |
| loop | boolean | false | When true, next and previous controls wrap around the slide list. |
| onIndexChange | (index: number) => void | - | Called whenever the active slide changes. |