Skip to content

Copy field

Pro

A read-only value with a copy button and its own confirmation. Not an M3 component (@windmorph/react-pro).

import { CopyField } from '@windmorph/react-pro';

Part of Windmorph Pro, paid components on the free core, not on sale yet. See the Pro guide for what it includes and to register interest.

Keyboard

Copy field keyboard
KeyAction
TabMoves to the field, then its copy button.
Enter or SpaceCopies, on the button.

Focus in the field selects its text, so it can also be copied with the keyboard.

Screen reader

Role
A read-only textbox and a button.
Accessible name
The field from label; the button from labels.copy, which changes to labels.copied or labels.copyFailed.
States announced
Read only, and disabled when disabled.

The result is announced in a polite live region mounted before it’s needed.

Focus

Focus stays on the button while the confirmation shows.

Touch target

The button has a 48px target, as the core’s icon buttons do.

Motion

The icon fades between its states, and still does under reduced motion, since a fade isn’t movement.

What you need to do

  • Give it a label that says what the value is.
  • Handle onCopyError where a copy that fails would strand someone.