{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "copy-button",
  "type": "registry:ui",
  "title": "Copy Button",
  "description": "Clipboard utility button with pop checkmark feedback.",
  "dependencies": [
    "clsx",
    "tailwind-merge",
    "lucide-react"
  ],
  "devDependencies": [],
  "registryDependencies": [],
  "files": [
    {
      "path": "components/ui/copy-button.tsx",
      "content": "import * as React from 'react'\nimport { Check, Copy } from 'lucide-react'\nimport { cn } from '@/lib/utils'\n\nexport interface CopyButtonProps\n  extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'children'> {\n  value: string\n  /** Milliseconds before reverting to the copy state. 0 disables auto-revert. */\n  resetDelay?: number\n  label?: React.ReactNode\n  copiedLabel?: React.ReactNode\n  ariaLabel?: string\n}\n\nexport function CopyButton({\n  value,\n  resetDelay = 2000,\n  label = 'Copy',\n  copiedLabel = 'Copied!',\n  ariaLabel = 'Copy to clipboard',\n  className,\n  onClick,\n  ...props\n}: CopyButtonProps) {\n  const [copied, setCopied] = React.useState(false)\n  const timeoutRef = React.useRef<ReturnType<typeof setTimeout> | null>(null)\n\n  React.useEffect(() => {\n    return () => {\n      if (timeoutRef.current) clearTimeout(timeoutRef.current)\n    }\n  }, [])\n\n  const handleClick = (event: React.MouseEvent<HTMLButtonElement>) => {\n    onClick?.(event)\n    if (navigator.clipboard?.writeText) {\n      navigator.clipboard.writeText(value)\n      setCopied(true)\n      if (resetDelay > 0) {\n        if (timeoutRef.current) clearTimeout(timeoutRef.current)\n        timeoutRef.current = setTimeout(() => setCopied(false), resetDelay)\n      }\n    }\n  }\n\n  return (\n    <button\n      type=\"button\"\n      aria-label={ariaLabel}\n      onClick={handleClick}\n      className={cn(\n        'inline-flex h-9 items-center justify-center gap-1.5 rounded-full bg-rk-surface px-3.5 font-sans text-xs font-extrabold text-rk-ink rk-border-sm rk-shadow-sm transition-all cursor-pointer select-none',\n        'hover:bg-rk-primary/70 active:translate-x-[2px] active:translate-y-[2px] active:shadow-none',\n        'focus-visible:outline-none focus-visible:ring-4 focus-visible:ring-black focus-visible:ring-offset-2',\n        className\n      )}\n      {...props}\n    >\n      {copied ? (\n        <Check className=\"h-3.5 w-3.5 stroke-[3]\" aria-hidden=\"true\" />\n      ) : (\n        <Copy className=\"h-3.5 w-3.5 stroke-[2.5]\" aria-hidden=\"true\" />\n      )}\n      <span>{copied ? copiedLabel : label}</span>\n    </button>\n  )\n}\n",
      "type": "registry:ui",
      "target": "components/ui/copy-button.tsx"
    }
  ]
}