{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "like-button",
  "title": "Like Button",
  "author": "VenusUI",
  "description": "A heart toggle that pops and bursts when liked, with an optional count.",
  "dependencies": [
    "lucide-react"
  ],
  "files": [
    {
      "path": "registry/default/ui/like-button.tsx",
      "content": "\"use client\"\n\nimport * as React from \"react\"\nimport { Heart } from \"lucide-react\"\n\nimport { cn } from \"@/lib/utils\"\n\ninterface LikeButtonProps extends Omit<React.ComponentProps<\"button\">, \"onChange\"> {\n  liked?: boolean\n  defaultLiked?: boolean\n  onLikedChange?: (liked: boolean) => void\n  /** Optional count shown next to the heart. It goes up or down by one as the button toggles. */\n  count?: number\n  /** Accessible name, e.g. \"Like this post\". */\n  label?: string\n}\n\n/**\n * A heart toggle that pops and bursts when liked. Exposes its state with\n * `aria-pressed`; the burst is decorative and skipped with reduced motion.\n */\nfunction LikeButton({ liked: controlled, defaultLiked = false, onLikedChange, count, label = \"Like\", className, onClick, ...props }: LikeButtonProps) {\n  const [internal, setInternal] = React.useState(defaultLiked)\n  const [burstKey, setBurstKey] = React.useState(0)\n  const liked = controlled ?? internal\n  const shownCount = count === undefined ? undefined : count + (liked && !defaultLiked ? 1 : !liked && defaultLiked ? -1 : 0)\n\n  return (\n    <button\n      type=\"button\"\n      aria-pressed={liked}\n      aria-label={label}\n      data-slot=\"like-button\"\n      onClick={(event) => {\n        onClick?.(event)\n        const next = !liked\n        if (controlled === undefined) setInternal(next)\n        onLikedChange?.(next)\n        if (next) setBurstKey((k) => k + 1)\n      }}\n      className={cn(\n        \"group relative inline-flex h-9 items-center gap-1.5 rounded-full border bg-background px-3 text-sm font-medium outline-none transition-colors\",\n        \"hover:bg-muted focus-visible:ring-3 focus-visible:ring-ring/50\",\n        liked && \"border-rose-500/40 text-rose-500\",\n        className\n      )}\n      {...props}\n    >\n      <span className=\"relative inline-flex\">\n        <Heart\n          aria-hidden=\"true\"\n          className={cn(\"size-4 transition-transform\", liked && \"animate-like-pop fill-current motion-reduce:animate-none\")}\n          key={`heart-${burstKey}`}\n        />\n        {liked && burstKey > 0 ? (\n          <span key={burstKey} aria-hidden=\"true\" className=\"pointer-events-none absolute inset-0 motion-reduce:hidden\">\n            {Array.from({ length: 6 }, (_, i) => (\n              <span\n                key={i}\n                className=\"absolute top-1/2 left-1/2 size-1 animate-like-burst rounded-full bg-rose-500\"\n                style={{ \"--burst-angle\": `${i * 60}deg` } as React.CSSProperties}\n              />\n            ))}\n          </span>\n        ) : null}\n      </span>\n      {shownCount !== undefined ? <span className=\"tabular-nums\">{shownCount}</span> : null}\n    </button>\n  )\n}\n\nexport { LikeButton, type LikeButtonProps }\n",
      "type": "registry:ui"
    }
  ],
  "cssVars": {
    "theme": {
      "animate-like-pop": "like-pop 400ms ease-out",
      "animate-like-burst": "like-burst 500ms ease-out forwards"
    }
  },
  "css": {
    "@keyframes like-pop": {
      "0%": {
        "transform": "scale(1)"
      },
      "40%": {
        "transform": "scale(1.35)"
      },
      "100%": {
        "transform": "scale(1)"
      }
    },
    "@keyframes like-burst": {
      "from": {
        "transform": "translate(-50%, -50%) rotate(var(--burst-angle)) translateY(0) scale(1)",
        "opacity": "1"
      },
      "to": {
        "transform": "translate(-50%, -50%) rotate(var(--burst-angle)) translateY(-14px) scale(0)",
        "opacity": "0"
      }
    }
  },
  "meta": {
    "version": "0.1.0"
  },
  "categories": [
    "buttons",
    "interactive",
    "animations"
  ],
  "type": "registry:ui"
}