UseClipboard
use-clipboard hook provides interface to work with navigator.clipboard
Usage
Code EditorCopyimport { useClipboard } from '@erudilabs/alma'
const { copy, copied } = useClipboard({ timeout: 500 })
Code EditorCopy<Button theme={copied ? 'success' : 'primary'} onClick={() => copy('Hello, world!')} > {copied ? 'Copied!' : 'Copy'} </Button>
Definition
Code EditorCopyfunction useClipboard(options: { timeout: number } = { timeout: 2000 }): { copy: (valueToCopy: any) => void; error: Error; copied: boolean; };