Copy button
v0.23.0Copies a value; the icon becomes a check for 1.5 s.
Copy button default
Install
npx shadcn add @syncrobotic/copy-button Also installs: lucide-react, @syncrobotic/cn, @syncrobotic/button
Overview
Copies a value and confirms it in place: the icon becomes a check for 1.5 s.
When to use
- IDs, references, install commands, coordinates.
Use something else
- Sharing a link to the current page: the browser already does it.
More examples
States and real uses. Each example is also a Storybook story and a visual regression test.
Copy button variants
Copy button in field
Usage rules
- The icon becomes a check for 1.5 s and the label says Copied: the swap pattern, never a toast.
- Icon-only needs a label that names what is copied (Copy reference).
Changelog
- 0.23.02026-11-20Every word it says can be translated without editing the source:
labels(copy,copied,failed,notCopied, which was fixed English).label,copiedLabelandfailedLabelstill work and win. - 0.10.02026-11-18Works over plain HTTP (falls back to execCommand when the Clipboard API is missing or refused), says so when the copy fails instead of failing silently, and announces the result for icon buttons too. Exports copyText().
- 0.8.02026-11-17First release.