{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "tilt-card",
  "title": "Tilt Card",
  "author": "VenusUI",
  "description": "A card that tilts in 3D toward the pointer, with a glare that follows it.",
  "files": [
    {
      "path": "registry/default/ui/tilt-card.tsx",
      "content": "\"use client\"\n\nimport * as React from \"react\"\n\nimport { cn } from \"@/lib/utils\"\n\ninterface TiltCardProps extends React.ComponentProps<\"div\"> {\n  /** Largest tilt in degrees. */\n  max?: number\n  /** Show a soft glare that follows the pointer. */\n  glare?: boolean\n}\n\n/**\n * A card that tilts in 3D toward the pointer, with a glare that follows it.\n * It settles back when the pointer leaves. Touch and keyboard users see a\n * normal card, and it stays flat with reduced motion.\n */\nfunction TiltCard({ max = 10, glare = true, className, style, children, ...props }: TiltCardProps) {\n  const ref = React.useRef<HTMLDivElement>(null)\n  const frame = React.useRef(0)\n\n  React.useEffect(() => () => cancelAnimationFrame(frame.current), [])\n\n  const onPointerMove = (event: React.PointerEvent<HTMLDivElement>) => {\n    if (event.pointerType === \"touch\") return\n    const card = ref.current\n    if (!card) return\n    const { clientX, clientY } = event\n    cancelAnimationFrame(frame.current)\n    frame.current = requestAnimationFrame(() => {\n      const rect = card.getBoundingClientRect()\n      const px = (clientX - rect.left) / rect.width\n      const py = (clientY - rect.top) / rect.height\n      card.style.setProperty(\"--tilt-x\", `${(0.5 - py) * max * 2}deg`)\n      card.style.setProperty(\"--tilt-y\", `${(px - 0.5) * max * 2}deg`)\n      card.style.setProperty(\"--glare-x\", `${px * 100}%`)\n      card.style.setProperty(\"--glare-y\", `${py * 100}%`)\n      card.style.setProperty(\"--glare\", \"1\")\n    })\n  }\n\n  const onPointerLeave = () => {\n    const card = ref.current\n    if (!card) return\n    cancelAnimationFrame(frame.current)\n    card.style.setProperty(\"--tilt-x\", \"0deg\")\n    card.style.setProperty(\"--tilt-y\", \"0deg\")\n    card.style.setProperty(\"--glare\", \"0\")\n  }\n\n  return (\n    <div className=\"perspective-[900px]\">\n      <div\n        ref={ref}\n        data-slot=\"tilt-card\"\n        onPointerMove={onPointerMove}\n        onPointerLeave={onPointerLeave}\n        className={cn(\n          \"relative overflow-hidden rounded-xl border bg-card text-card-foreground transition-transform duration-200 ease-out will-change-transform transform-3d\",\n          \"[transform:rotateX(var(--tilt-x,0deg))_rotateY(var(--tilt-y,0deg))] motion-reduce:[transform:none]\",\n          className\n        )}\n        style={style}\n        {...props}\n      >\n        {children}\n        {glare ? (\n          <div\n            aria-hidden=\"true\"\n            className=\"pointer-events-none absolute inset-0 opacity-(--glare,0) transition-opacity duration-300 motion-reduce:hidden\"\n            style={{\n              background:\n                \"radial-gradient(circle at var(--glare-x, 50%) var(--glare-y, 50%), color-mix(in oklch, white 22%, transparent), transparent 55%)\",\n            }}\n          />\n        ) : null}\n      </div>\n    </div>\n  )\n}\n\nexport { TiltCard, type TiltCardProps }\n",
      "type": "registry:ui"
    }
  ],
  "meta": {
    "version": "0.1.0"
  },
  "categories": [
    "cards",
    "interactive",
    "3d"
  ],
  "type": "registry:ui"
}