Component
CopyButton
A utility button that writes to the clipboard and handles its own success state.
Usage
Click to copy text
tsx
<CopyButton value="npm install starkit-ui">Copy Install Command</CopyButton>
Customization
Custom label and timeout
tsx
<CopyButton value="secret_key" copiedLabel="Got it!" timeout={1000} variant="primary">
Copy Secret Key
</CopyButton>
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| value | string | — | The text to copy to clipboard. |
| timeout | number | 2000 | Duration in ms before the button resets to normal. |
| copiedLabel | string | 'Copied ✓' | Text to display when successfully copied. |
| onCopy | () => void | — | Callback fired after copying. |
Accepts all standard ButtonProps.
★ GitHub