useCopy ​
browser
test coverage
Last changed: last month
TIP
This hook uses navigator.clipboard browser api to provide enhanced functionality. Make sure to check for compatibility with different browsers when using this api
Hook that manages copying text with status reset
typescript
import { useCopy } from '@siberiacancode/reactuse';
Usage ​
typescript
const { copied, value, copy } = useCopy();
Demo ​
Api ​
Parameters
Name | Type | Default | Note |
---|---|---|---|
delay? | number | 1000 | Delay in ms before resetting copied status |