Copy button
npm installnpx shadcn add @klarhimmel/copy-buttonCopy for AIDetailsAbout, usage, props and more
An icon button that copies a value and confirms with a check.
When to use
Use for
Next to a command, token or id people paste elsewhere.
Not for
Long text. Offer a download instead.
Pairs with
Command boxes, code blocks.
Preview
npx shadcn add @klarhimmel/buttonImport
Import
- Files
- copy-button.tsx, in components/klarhimmel/ui/. With it: theme, utils. npm: lucide-react.
- Render in
- Render it inside <Theme>, once near the root of your app. Tokens and fonts are scoped to it, so outside it the component is unstyled.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
value | string | required | Required. The text copied to the clipboard. |
label | string | 'Copy' | Accessible name of the button. |
copiedLabel | string | 'Copied' | |
className | string | - | Extra classes, merged after the component's own. |