Skip to main content
  1. Docs
  2. Components
  3. Actions

Copy button

Copies a value. The icon turns to a check, "Copied" is announced, and focus stays.

Import
@qeetrix/react/experimental
Status
ExperimentalSince 0.0.4
Renders
<button>Server-rendered
Tested
WCAG 2.2 AAaxe on every pull request

01

When to use

Use it for
  • Ids, keys, URLs and commands that are pasted somewhere else.
  • Values too long, or too exact, to select by hand.
  • A value made at the moment it's copied: an invite link, a token.
Not for

02

Anatomy

  1. 1icon-button<button>The root: an Icon button, or a Button with a label. data-state: idle, copied, failed.
  2. 2button-icon<svg>Copy; a check once copied; an alert if it couldn't.

03

Do and don't

Beside what it copies
DoNext to its value, so it's clear what goes.
Don'tA copy button on its own: copy what?
Named for its value
Dolabel says what it copies: "Copy client ID".
Don'tThree buttons, each just "Copy".
Quiet beside its value
DoGhost and neutral: the value leads.
Don'tA solid brand button for a utility.

04

Sizes

Each height follows the region's density.

SizeSquare: compact / default / comfortableIcon
sm24 / 28 / 3216px
md28 / 32 / 3616px
lg32 / 40 / 4420px

05

Content

  • Name what it copies: "Copy client ID", "Copy redirect URI".
  • Leave "Copied" to it: it shows it, and announces it.
  • A visible label only where there's room: "Copy invite link".
Next — Copy buttonAPI