Skip to content

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.json

Usage

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

PropTypeDefaultDescription
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.
intervalnumber5200Milliseconds each card stays expanded.
durationnumber1.2Seconds per handoff.
collapsedHeightnumber48Pill height in px.
expandedHeightnumber224Expanded card height in px.
collapsedScalenumber0.84Scale applied to collapsed pills.
gapnumber12Space between slots in px.
pausedbooleanfalseStops the cycle.
cardClassNamestring—Classes for each card shell.
classNamestring—Fills its container's width; cap it here, e.g. max-w-sm.