useCopyToClipboard
Copy text to clipboard with a brief 'copied' flash state.
Import
import { useCopyToClipboard } from "neoterm-ui";Usage
const { copied, copy } = useCopyToClipboard();
<Button onClick={() => copy("npm install neoterm-ui")}>
{copied ? "Copied!" : "Copy"}
</Button>Signature
function useCopyToClipboard(resetMs?: number): {
copied: boolean;
copy: (text: string) => Promise<void>;
}Parameters
| Prop | Type | Default | Description |
|---|---|---|---|
| resetMs | number | 2000 | Time in ms before copied resets to false. |