{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "copy-button",
  "registryDependencies": [
    "https://turnui.xyz/r/turn-button.json"
  ],
  "files": [
    {
      "path": "src/registry/ui/copy-button.tsx",
      "content": "\"use client\";\n\nimport * as React from \"react\";\nimport { Button } from \"./turn-button\";\n\n/** Icon button that copies text and confirms through a status region. Sits in the MessageActions row. */\nexport function CopyButton({\n  value,\n  label = \"Copy\",\n  className,\n}: {\n  /** Text to copy, or a function that returns it at click time. */\n  value: string | (() => string);\n  /** Accessible name. */\n  label?: string;\n  className?: string;\n}) {\n  const [copied, setCopied] = React.useState(false);\n  const timer = React.useRef<ReturnType<typeof setTimeout>>(undefined);\n  React.useEffect(() => () => clearTimeout(timer.current), []);\n\n  async function copy() {\n    try {\n      await navigator.clipboard.writeText(typeof value === \"function\" ? value() : value);\n    } catch {\n      return;\n    }\n    setCopied(true);\n    clearTimeout(timer.current);\n    timer.current = setTimeout(() => setCopied(false), 1500);\n  }\n\n  return (\n    <>\n      <Button type=\"button\" variant=\"ghost\" size=\"icon\" aria-label={label} onClick={copy} className={className}>\n        {copied ? (\n          <svg viewBox=\"0 0 16 16\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"1.75\" strokeLinecap=\"round\" strokeLinejoin=\"round\" aria-hidden><path d=\"m3 8.5 3.5 3.5L13 4.5\" /></svg>\n        ) : (\n          <svg viewBox=\"0 0 16 16\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"1.5\" strokeLinejoin=\"round\" aria-hidden><rect x=\"5.5\" y=\"5.5\" width=\"8\" height=\"8\" rx=\"1\" /><path d=\"M10.5 5.5v-2a1 1 0 0 0-1-1h-6a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2\" /></svg>\n        )}\n      </Button>\n      <span role=\"status\" className=\"sr-only\">{copied ? \"Copied to clipboard\" : \"\"}</span>\n    </>\n  );\n}\n",
      "type": "registry:ui"
    }
  ],
  "type": "registry:ui"
}