"use client"; import { useState } from "react"; interface Props { value: string; label: string; } export default function CopyButton({ value, label }: Props) { const [copied, setCopied] = useState(false); async function copy() { try { await navigator.clipboard.writeText(value); setCopied(true); setTimeout(() => setCopied(false), 1500); } catch { // Fallback for old browsers / non-secure contexts: select the next //
and let the user hit ⌘C themselves.
}
}
return (
);
}