Copy Button
An icon button that copies a value too long to type (protocol, tracking code, Pix code, token) to the clipboard.
Overview
- Feedback: the icon turns into a check, or a cross on failure, for a moment, and the outcome is announced in a separate live region.
- Labels: translatable; an optional tooltip shows them.
- `useCopyToClipboard`: also exported, for other triggers such as a menu item.
Installation
CLI
Manual
- 1
Register the @fma-ds namespace in components.json (once)
- 2
Add the item
Files land in
components/fma-ds/copy-button.tsx; npm and registry dependencies are installed along with them.
Dependencies
- npm
- cn@^0.5.0lucide-react@^1.61.0
- Registry
- @fma-ds/button@fma-ds/tooltip