Card Stack
A looping vertical deck: pills slide in, the middle card blooms open, then folds away below.
1 variantNew
Preview
Installation
Copies the component into components/ui and installs its dependencies and theme tokens.
pnpm dlx shadcn@latest https://floret.shippedui.com/r/card-stack.jsonUsage
Pass your own data and wire the callbacks to your app.
import { CardStack } from "@/components/ui/card-stack";
<CardStack
items={reports}
renderHeader={(report) => (
<div className="flex w-full items-center justify-between">
<span className="text-sm font-medium">{report.owner}</span>
<span className="text-sm text-muted-foreground">{report.title}</span>
</div>
)}
renderBody={(report) => <Sparkline data={report.series} />}
/>Props
| Prop | Type | Default | Description |
|---|---|---|---|
| items* | readonly T[] | — | Cards to cycle through; the deck wraps around. |
| renderHeader* | (item: T, index: number) => ReactNode | — | The strip shown on every card. It is the entire card while collapsed. |
| renderBody* | (item: T, index: number) => ReactNode | — | Content revealed under the header while the card is expanded. |
| interval | number | 5200 | Milliseconds each card stays expanded. |
| duration | number | 1.2 | Seconds per handoff. |
| collapsedHeight | number | 48 | Pill height in px. |
| expandedHeight | number | 224 | Expanded card height in px. |
| collapsedScale | number | 0.84 | Scale applied to collapsed pills. |
| gap | number | 12 | Space between slots in px. |
| paused | boolean | false | Stops the cycle. |
| cardClassName | string | — | Classes for each card shell. |
| className | string | — | Fills its container's width; cap it here, e.g. max-w-sm. |