Copy button

copy-buttonActions

Copies one exact value in one press, then confirms with a tick and a polite announcement. Use it beside tokens, IDs and commands.

bunx --bun shadcn@4.17.0 add @waimakers/copy-button
Kit dependencies
utilsthemebutton
npm dependencies
lucide-react@1.33.0

From the registry

One exact value taken to the clipboard in one keystroke, composed over the kit's Button because the shadcn registry carries no copy control. Idle, copied and refused are three states and three announcements: the outcome lands in a visually-hidden role="status" region, so a person who cannot see the tick is told at the same moment, and a browser that refuses clipboard access says so instead of doing nothing.

Examples

Icon only

The default: an icon button named by its label, for tight spots beside a value.

agt_7f3k2m9q

With label

Add children when the action needs words.

Variants

It takes the Button variants; outline is the default.

States

A refused clipboard announces the failure and asks for a manual copy. Disabled and focus follow Button.