Components
Copy Button
Icon button that copies a value and confirms with a checkmark.
Copies a value to the clipboard. The icon turns into a checkmark for two seconds, and “Copied” is announced to screen readers.
Installation
Section titled “Installation”npx shadcn@latest add @0xui/copy-buttonpnpm dlx shadcn@latest add @0xui/copy-buttonyarn dlx shadcn@latest add @0xui/copy-buttonbunx --bun shadcn@latest add @0xui/copy-buttonimport { CopyButton } from "@/components/copy-button";
<CopyButton value={address} label="Copy address" />;Always pass a specific label. It is the button’s only accessible name.
Examples
Section titled “Examples”Other button styles
Section titled “Other button styles”Accepts every shadcn Button prop, including variant and size.
<CopyButton value={hash} label="Copy transaction hash" variant="outline" size="icon" />States
Section titled “States”| State | What the user sees |
|---|---|
| Idle | Copy icon. |
| Copied | Checkmark for timeout ms, “Copied” announced. data-copied is set on the button. |
| Clipboard blocked | Nothing changes and onCopy is not called. |
Also accepts all shadcn Button props except onClick and children.
| Prop | Type | Default | Description |
|---|---|---|---|
value |
string |
— | Text to copy. |
label |
string |
"Copy" |
Accessible label and tooltip. |
timeout |
number |
2000 |
How long the copied state lasts, in ms. |
onCopy |
(value: string) => void |
— | Called after a successful copy. |
copyIcon |
ComponentType | false |
CopyIcon |
Custom icon, or false to hide it. |
copiedIcon |
ComponentType | false |
CheckIcon |
Custom icon, or false to hide it. |
