UseClipboard

A hook to simplify copying text to the clipboard.

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.

Status

You can check .status to determine if the copy was a success or failure and update the state accordingly.