Copy Button
stableCopies text to the clipboard with success feedback.
Basic usage
npx structyl initExamples
In a code block
Pair CopyButton with a styled code block — the typical documentation pattern.
pnpm add @structyl/styled
Copy command and tokens
CopyButton can be used beside code, API keys and generated theme values.
pnpm add @structyl/styledFeatures
- Animated check feedback.
- Configurable reset delay.
Installation
bash
pnpm dlx structyl add copy-buttonAPI Reference
CopyButton
Copies text to the clipboard with success feedback.
| Prop | Type | Default |
|---|---|---|
| value | stringThe text to copy. | — |
| resetAfter | numberTime before the icon resets (ms). | 2000 |
| onCopied | (value: string) => voidCalled after a successful copy. | — |