import { UseClipboardOptions } from "hooks"; /** * * @kind 07-Misc */ export const useClipboard = (options?: UseClipboardOptions) => { const { onSuccess, onError } = options || {}; const handleCopy = (text: string) => { navigator.clipboard.writeText(text).then( () => { onSuccess?.(text); }, (error) => { onError?.(error, text); }, ); }; return { copy: handleCopy, }; };