Installation
jsrepo add hooks/use-clipboard.svelte
Usage
Create a button that copies some text to the clipboard.
Delay
So that you can show a status to your users UseClipboard delays resetting the state of .copied. By default this delay is set to 500ms.
const clipboard = new UseClipboard({ delay: 500 });
Status
You can check .status to determine if the copy was a success or failure and update the state accordingly.