★ GitHub
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

PropTypeDefaultDescription
valuestring—The text to copy to clipboard.
timeoutnumber2000Duration in ms before the button resets to normal.
copiedLabelstring'Copied ✓'Text to display when successfully copied.
onCopy() => void—Callback fired after copying.

Accepts all standard ButtonProps.