{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "card-stack",
  "title": "Card Stack",
  "author": "VenusUI",
  "description": "Stacked cards with the next ones peeking out; Next sends the top card to the back.",
  "dependencies": [
    "motion",
    "lucide-react"
  ],
  "files": [
    {
      "path": "registry/default/ui/card-stack.tsx",
      "content": "\"use client\"\n\nimport * as React from \"react\"\nimport { motion, useReducedMotion } from \"motion/react\"\nimport { ChevronRight } from \"lucide-react\"\n\nimport { cn } from \"@/lib/utils\"\n\ninterface CardStackItem {\n  id: string\n  /** Announced when the card reaches the top. */\n  label: string\n  content: React.ReactNode\n}\n\ninterface CardStackProps {\n  items: CardStackItem[]\n  /** Accessible name for the stack. */\n  label?: string\n  className?: string\n}\n\nconst VISIBLE = 3\n\n/**\n * Cards stacked with the next ones peeking out behind. \"Next\" sends the top\n * card to the back with a spring. Only the top card is interactive and its\n * label is announced. With reduced motion the cards swap without moving.\n */\nfunction CardStack({ items, label = \"Card stack\", className }: CardStackProps) {\n  const [order, setOrder] = React.useState(() => items.map((item) => item.id))\n  const reduceMotion = useReducedMotion()\n  const byId = new Map(items.map((item) => [item.id, item]))\n  const top = byId.get(order[0] ?? \"\")\n\n  return (\n    <section aria-label={label} data-slot=\"card-stack\" className={cn(\"flex w-full max-w-sm flex-col items-center gap-8\", className)}>\n      <div className=\"relative h-56 w-full\">\n        {order.slice(0, VISIBLE).map((id, depth) => {\n          const item = byId.get(id)\n          if (!item) return null\n          const isTop = depth === 0\n          return (\n            <motion.div\n              key={id}\n              aria-hidden={!isTop}\n              inert={!isTop ? true : undefined}\n              className=\"absolute inset-x-0 top-0 h-48 overflow-hidden rounded-xl border bg-card p-5 shadow-sm\"\n              style={{ zIndex: VISIBLE - depth, transformOrigin: \"top center\" }}\n              animate={{ y: depth * 14, scale: 1 - depth * 0.05, opacity: 1 - depth * 0.2 }}\n              transition={reduceMotion ? { duration: 0 } : { type: \"spring\", stiffness: 260, damping: 26 }}\n            >\n              {item.content}\n            </motion.div>\n          )\n        })}\n      </div>\n      <div className=\"flex items-center gap-3\">\n        <p aria-live=\"polite\" className=\"text-sm text-muted-foreground\">\n          {top?.label}\n        </p>\n        <button\n          type=\"button\"\n          onClick={() => setOrder((current) => [...current.slice(1), ...current.slice(0, 1)])}\n          className=\"inline-flex h-9 items-center gap-1 rounded-full border bg-background px-4 text-sm font-medium outline-none hover:bg-muted focus-visible:ring-3 focus-visible:ring-ring/50\"\n        >\n          Next\n          <ChevronRight aria-hidden=\"true\" className=\"size-4\" />\n        </button>\n      </div>\n    </section>\n  )\n}\n\nexport { CardStack, type CardStackItem, type CardStackProps }\n",
      "type": "registry:ui"
    }
  ],
  "meta": {
    "version": "0.1.0"
  },
  "categories": [
    "cards",
    "interactive",
    "animations"
  ],
  "type": "registry:ui"
}