Image compare
Drag a divider across two images to see what changed.
Browse a row of slides by dragging, flicking, or arrowing through them.
npx shadcn@latest add @silicon-ui/carouselnpx shadcn@latest add @silicon-ui/carouselInstall the dependencies.
npm install lucide-react motionCopy these files into your project. Shared files are skipped if you already have them.
components/silicon-ui/carousel/carousel.tsxcomponents/silicon-ui/carousel/carousel.module.cssInstall the foundation once per app for the design and motion tokens: npx shadcn@latest add @silicon-ui/silicon-foundation
| Prop | Type | Default |
|---|---|---|
label*Names the carousel for assistive technology, for example "From the Harbour suites". | string | — |
children*One child per slide. | ReactNode | — |
indexControlled active slide. Pair with `onIndexChange`. | number | — |
defaultIndex | number | 0 |
onIndexChange | (index: number) => void | — |
slideSizeWidth of one slide as a CSS length. Use `cqw` for a share of the carousel width. | string | "min(80cqw, 340px)" |
slideLabelNames each slide and its indicator. Defaults to "2 of 5". | (index: number, count: number) => string | defaultSlideLabel |
intervalMilliseconds per slide. Adds a play control that rotates through the slides; rotation pauses on hover, keyboard focus, and drag, and is unavailable with reduced motion. | number | — |
autoplayStarts rotating on mount. Off by default, so motion begins with the viewer. | boolean | false |
className | string | — |