Copy text to the clipboard with status tracking and optional reset delay.
const { copy, status, isCopied, isCopying, isError } = useCopy(resetDelay);
Status: standby
import { useCopy } from 'kitzo'; function CopyDemo() { const { copy, status } = useCopy(2000); return ( <div> <input onChange={(e) => setText(e.target.value)} /> <button onClick={() => copy(text)}>Copy</button> <p>Status: {status}</p> </div> ); }
| Parameter | Type | Description |
|---|---|---|
resetDelay | number | Time in milliseconds to reset the copy status to standby |
Returns a copy function and status flags to track the copy process.
standby, copying, copied, or errorstandby after resetDelayisCopying, isCopied, isError, isStandby