@sparkpost/matchbox
Version:
A React UI component library
18 lines (17 loc) • 471 B
TypeScript
/**
* SSR friendly hook that copies a string to the clipboard and provides copied state
*
* @example
* const { copy, copied } = useCopyToClipboard({ timeout: 2000 });
*
* <Button onClick={() => copy('string')}>
* {copied ? 'String has been copied' : 'Copy to clipboard'}
* </Button>
*/
declare function useCopyToClipboard({ timeout }?: {
timeout?: number;
}): {
copy: (string: string) => void;
copied: boolean;
};
export default useCopyToClipboard;