Copy value
Outside the canonClick-to-copy for record numbers, tracking IDs and reference codes: the workshop's Copy Button exactly (2026-10-08). The rule: a value you paste somewhere else gets a copy, a value you only read does not — not amounts, dates or names. The whole mono value plus the icon is one button (px-2 py-1, rounded-md); the icon rests at 40% stone and goes stone-dark on hover, with a surface-muted wash on the whole button. Copied swaps the icon for a check and the whole button to status-success-bg for 2 seconds. Icon 16px by default, 14px in inline and table contexts. Feedback stays in place rather than a toast, with an aria-live line for screen readers. A value that must stay a link keeps its link and gets the icon-only form of the same button beside it.
App: a `clipboard` Stimulus controller (new): the value to copy, and a `copied` class toggled for 2s that swaps the two icon spans and the background
Default
#defaultThe workshop's Copy Button: the whole mono value and the icon are one button. The icon rests at 40% stone; hover the button for the surface-muted wash and a stone-dark icon. Press it: a check on status-success-bg for 2 seconds, then back.
In the Document rail
#railIn context the icon is 14px (size="sm"). The button is pulled back by its own padding, so the value still ends on the rail's right edge.
Beside a link
#linkA value that must stay a link cannot sit inside a button, so the link is drawn as given and the copy is the same button with the icon alone: same wash, same 40% icon, same green state.
Props
| Name | Type | Default | Notes |
|---|---|---|---|
| value | string | — | What lands on the clipboard, and what is shown |
| children | ReactNode | — | Only for a value that must stay a link: the link is drawn as given and the copy becomes an icon-only button beside it |
| copy_label | string | Copy to clipboard | Tooltip and accessible name (the name also carries the value) |
| mono | boolean | true | The workshop sets every copyable value mono |
| size | base | sm | base | Icon 16px; sm (14px) inline, in a table or in the Document rail |