CopyField

A value to hand on — the venue's chat link — in a read-only field with a copy button beside it, set like any Input. Copying turns the icon into a tick and announces it; where the clipboard is blocked, the value is selected instead. Composed from Input and Button.

Playground

CopyField
Labels

In a field

With a visible label, pass id and point the FieldLabel's htmlFor at it instead of passing label. A description can say where the value goes. For a link, display shows it without its https://, so the studio's own part fits on a phone; the button still copies the whole value.

Put it in your Instagram bio and Google profile — clients book here.

Sizes

One size sets the field and the button together: sm 32px, md 36px by default, lg 40px.

In the venue's language

The button's name and the “copied” announcement are props, so they come from the same translations as the rest of the screen.

CopyButton: the button alone

The field's button on its own, where the value needn't show: the booking link beside the studio's name in Studio. Its icon can say what it copies (a link), and it can be a ghost.

API reference

PropTypeDefaultDescription
valuestring—The text to show and copy — a link, a code.
displaystringvalueWhat the field shows instead — a link without https://. The button still copies value.
labelstring—The field's name for assistive tech, when no FieldLabel points at id.
idstring—Lands on the input, for a FieldLabel's htmlFor.
copyLabelstring"Copy"The copy button's accessible name. Say what it copies: “Copy chat link”.
copiedLabelstring"Copied"Announced politely once the value is on the clipboard.
aria-describedbystring—Links the input to a FieldDescription.
size"sm" | "md" | "lg""md"Field and button together: 32, 36 or 40px.
classNamestring—Layout only, on the row that holds field and button.

Guidelines

  • For values people pass on, not edit: the chat link, a referral code. If they might change it, it's an Input.
  • Name the button for what it copies (“Copy chat link”), and pass both labels from translations — the defaults are English.
  • The tick lasts a moment and the change is announced; don't add a toast on top.
  • Give it the column's full width. A link cut off halfway is hard to trust before it's pasted.