Actions
Copy Button
A button that copies value to the clipboard and confirms with a checkmark. Use it icon-only or with a label. Once it copies, screen readers hear "Copied".
ReactVueWeb Components
View in Storybook Playground
Examples
<CopyButton value="--lily-color-primary-100" />
<CopyButton value={code} label="Copy" /> Props
| Name | Type | Default | Description |
|---|---|---|---|
value required | string | — | The text written to the clipboard on click. |
label | ReactNode | — | Visible label beside the icon. Omit for an icon-only button. |
copyLabel | string | Copy | Accessible name (used as `aria-label`, esp. when icon-only). @default 'Copy' |
copiedLabel | string | Copied | Announced and shown briefly after a successful copy. @default 'Copied' |
size | 'sm' | 'md' | md | Control size. @default 'md' |
onCopy | (value: string) => void | — | Called with the copied value after a successful copy. |
className | string | — |
Accessibility
- Body/background contrast is ≥ 7:1 (AAA) in both light and dark.
- Every interaction works with the keyboard alone.
- The focus ring is always visible.
- Respects prefers-reduced-motion and stops excessive motion.
Every component is designed to meet WCAG 2.1 AAA.