122 components
Copy to clipboard hook with async support
Copy this text!npm install @djangocfg/ui-nextjshttps://github.com/yourusername/repoconst hello = "world";const { copyToClipboard } = useCopy();
const [copied, setCopied] = useState(false);
const handleCopy = async () => {
await copyToClipboard('text to copy');
setCopied(true);
setTimeout(() => setCopied(false), 2000);
};
return (
<Button onClick={handleCopy}>
{copied ? 'Copied!' : 'Copy'}
</Button>
);Import