CopyButton

Icon button that copies a value to the clipboard with copied feedback

Category: inputs · WCAG 2.2-AA · clipboard, copy, button, snippet

Sizes

States

Props

PropTypeDefaultDescription
valuestringThe text written to the clipboard on click
size'sm' | 'md'mdVisual size of the component (e.g. 'sm', 'md', 'lg').
labels{ copy?: string; copied?: string }Overrides the built-in i18n labels per instance

Design tokens

When to use

When not to use

How to build an accessible CopyButton in React →

Examples

Default

<CopyButton value="npx cascivo add button" />

Small

<CopyButton value="pnpm install" size="sm" />

Custom labels

Override the built-in copy/copied strings per instance

<CopyButton value="token" labels={{ copy: 'Copy token', copied: 'Token copied' }} />

Related components

← Back to docs