{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "extends": "none",
  "name": "use-clipboard",
  "title": "use-clipboard",
  "description": "use-clipboard",
  "files": [
    {
      "path": "src/hooks/use-clipboard.ts",
      "content": "import { useEffect, useRef, useState } from 'react'\n\nexport function useClipboard() {\n  const [copied, setCopied] = useState(false)\n  const timeoutRef = useRef<number | null>(null)\n\n  const copy = async (value: string) => {\n    try {\n      await navigator.clipboard.writeText(value)\n      setCopied(true)\n      if (timeoutRef.current) window.clearTimeout(timeoutRef.current)\n      timeoutRef.current = window.setTimeout(() => setCopied(false), 2000)\n      return true\n    } catch {\n      if (timeoutRef.current) window.clearTimeout(timeoutRef.current)\n      timeoutRef.current = null\n      setCopied(false)\n      return false\n    }\n  }\n\n  useEffect(() => {\n    return () => {\n      if (timeoutRef.current) window.clearTimeout(timeoutRef.current)\n    }\n  }, [])\n\n  return { copy, copied }\n}\n",
      "type": "registry:hook"
    }
  ],
  "type": "registry:hook"
}