Skip to content
Zuno UI
Explore components
EXPLORE
Actions
Forms
Layout
Navigation
Data display
Feedback
Overlays
RESOURCES
Components/CopyButton

CopyButton

Copy to clipboard with confirmation and error handling; a stable accessible name.

Installation

Run it from the root of a project already set up with zunoui init.

npx zunoui@latest add copy-button

Dependencies

What add copy-button installs alongside the component. The CLI skips any you already have in a compatible version.

ZUNO registry

Examples

1 examples · 1 component
copy-button

Copy with confirmation

Confirms the copy and reverts after a few seconds.

API reference

Forwards props and ref to the container element; it only adds composition utilities.

PropTypeDefault
value

Text copied to the clipboard.

string—
label

Stable accessible name of the button.

string"Copy"
...ButtonProps

Accepts variant, size and the rest of the Button props.

——

States

The states that apply to this component and their visual treatment.

StateTreatment
RestButton with its stable aria-label.
CopiedConfirms with an icon and role="status" text; reverts after a few seconds.
ErrorIf the clipboard fails, it says so with an icon and text.

Accessibility

The aria-label stays stable; the result is announced with role="status" text.

The icon changes to confirmation or error, but the state is also communicated through text.