Carousel
Browse a row of slides by dragging, flicking, or arrowing through them.
Drag a divider across two images to see what changed.
npx shadcn@latest add @silicon-ui/image-comparenpx shadcn@latest add @silicon-ui/image-compareInstall the dependencies.
npm install lucide-react motionCopy these files into your project. Shared files are skipped if you already have them.
components/silicon-ui/image-compare/image-compare.tsxcomponents/silicon-ui/image-compare/image-compare.module.cssInstall the foundation once per app for the design and motion tokens: npx shadcn@latest add @silicon-ui/silicon-foundation
| Prop | Type | Default |
|---|---|---|
before*The original, shown on the left (or top). Pass an image with its own alt text; it is sized to cover the frame. | ReactNode | — |
after*The result, shown on the right (or bottom). | ReactNode | — |
positionWhere the divider sits, in percent from the left (or top). | number | — |
defaultPosition | number | 50 |
onPositionChange | (position: number) => void | — |
orientationVertical stacks the images top and bottom. Changing it swings the divider a quarter turn instead of swapping layouts. | "horizontal" | "vertical" | "horizontal" |
labelsCaptions over each side. They fade as the divider reaches them. Pass false to hide them. | [string, string] | false | ["Before", "After"] |
labelAccessible name of the divider. | string | "Before and after" |
aspectRatioFrame proportions, as a CSS aspect-ratio. | string | "3 / 2" |
className | string | — |