Card Stack
ProA stack of cards you can drag, swipe, click or arrow through.
Installation
pnpm dlx shadcn@latest add @viewport/card-stack
First time? Add the @viewport registry to components.json. Setup takes one minute.
Usage
The code behind the preview above comes with Truffle Pro.
Props
| Prop | Type | Default |
|---|---|---|
| items* | T[] | — |
| render* | (item: T, index: number) => React.ReactNodeRenders one card. | — |
| autoplay | numberAdvance automatically every N milliseconds. Paused on hover and focus. | — |
| label | stringAccessible name for the carousel. | "Cards" |
| className | string | — |
Accessibility
- Exposed as a carousel; arrow keys and buttons change cards.
- Announces the position through a live region.
- Cards behind the top one are inert.
- Autoplay pauses on hover and focus and is off under reduced motion.