Image compare
Drag a divider across two images to see what changed.
Review a deck one card at a time, with a throw and an undo.
npx shadcn@latest add @silicon-ui/card-stacknpx shadcn@latest add @silicon-ui/card-stackInstall the dependencies.
npm install lucide-react motionCopy these files into your project. Shared files are skipped if you already have them.
components/silicon-ui/card-stack/card-stack.tsxcomponents/silicon-ui/card-stack/card-stack.module.cssInstall the foundation once per app for the design and motion tokens: npx shadcn@latest add @silicon-ui/silicon-foundation
| Prop | Type | Default |
|---|---|---|
items* | T[] | — |
getKey* | (item: T) => string | — |
getLabel*A short name for the card, used in its accessible label and announcements, such as "Lisbon". | (item: T) => string | — |
renderCard* | (item: T) => ReactNode | — |
onDecide | (item: T, decision: CardDecision) => void | — |
onUndo | (item: T, decision: CardDecision) => void | — |
onReset | () => void | — |
labelsAction names for each side, used on the buttons and the stamps that appear while dragging. | { left: string; right: string } | { left: "Pass", right: "Keep" } |
outcomesPast tense of each action for announcements, such as "skipped" and "shortlisted". | { left: string; right: string } | — |
labelAccessible name for the stack. | string | "Cards" |
renderEmptyShown once every card has been decided. Receives a function that brings all cards back. | (reset: () => void) => ReactNode | — |
className | string | — |