Skip to content
VenusUI
Get started

Card Stack

Stacked cards with the next ones peeking out; Next sends the top card to the back.

Preview

Installation

npx shadcn@latest add @venusui/card-stack

Run this in a project set up with shadcn. If you haven’t set it up yet, run npx shadcn@latest init first.

Files added to your project

Paths use the default shadcn aliases. The CLI follows the aliases in your components.json.

  • @/components/ui/card-stack.tsx

Usage

The code behind the preview above.

card-stack-demo.tsx

import { CardStack } from "@/components/ui/card-stack"

const notes = ["Ship the beta", "Write the changelog", "Plan the launch", "Collect feedback"]

export default function CardStackDemo() {
  return (
    <CardStack
      label="Tasks"
      items={notes.map((note, i) => ({
        id: note,
        label: note,
        content: (
          <div className="flex h-full flex-col justify-between">
            <span className="font-mono text-xs text-muted-foreground">Task {i + 1}</span>
            <span className="text-xl font-semibold tracking-tight">{note}</span>
          </div>
        ),
      }))}
    />
  )
}

API reference

PropTypeDefaultDescription
items{ id: string; label: string; content: ReactNode }[]—Cards. label is announced when a card reaches the top. Required.
labelstring"Card stack"Accessible name for the stack.

Only the props above, plus className.

Requirements

  • motion and lucide-react. The CLI installs both.
  • React 19 and Tailwind CSS v4.

Customization

  • Three cards are visible; change VISIBLE in the file for a deeper stack.

Accessibility

  • Only the top card is interactive; the others are inert. The top card’s label is announced.
  • Cards swap without moving with reduced motion.

Troubleshooting

Content is cut off.
Cards are h-48; increase it (and the wrapper h-56) for more content.
Unknown registry "@venusui"
Your shadcn CLI couldn’t find the namespace in the shadcn registry index. Use the latest CLI (npx shadcn@latest), install by URL, or register it with its address: npx shadcn@latest registry add @venusui=https://venusui.com/r/{name}.json.
No components.json found
Run npx shadcn@latest init in your project first.
Loading preview

A card that tilts in 3D toward the pointer with spring physics.

Loading preview

Envelope

Interactive

A sealed envelope that opens on hover or click: the flap folds back and the letter slides out.

Loading preview

A two-sided card that turns over in 3D, by button or on hover.