diff --git a/docs/src/components/copy-button.tsx b/docs/src/components/copy-button.tsx index 37e5bbe..97930ca 100644 --- a/docs/src/components/copy-button.tsx +++ b/docs/src/components/copy-button.tsx @@ -10,9 +10,14 @@ export function CopyButton({ code }: CopyButtonProps) { const [copied, setCopied] = useState(false); const handleCopy = async () => { - await navigator.clipboard.writeText(code); - setCopied(true); - setTimeout(() => setCopied(false), 2000); + try { + await navigator.clipboard.writeText(code); + setCopied(true); + setTimeout(() => setCopied(false), 2000); + } catch (error) { + console.error("Failed to copy to clipboard:", error); + // Optionally, you could set an error state or show a toast notification here + } }; return (