Skip to main content

hooks/use-copy

Functions​

useCopy()​

useCopy(timeout?): object

Defined in: hooks/use-copy.ts:9

Copy text to the clipboard and expose copied / failed flags for the last attempt. Either flag resets after timeout ms; they are never both true. copy resolves to whether the copy succeeded.

Parameters​

timeout?​

number = 2000

Returns​

object

copy​

copy: (text) => Promise<boolean>

Parameters​
text​

string

Returns​

Promise<boolean>

copied​

copied: boolean

failed​

failed: boolean