Copy field
ProA 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
| Key | Action |
|---|---|
| Tab | Moves to the field, then its copy button. |
| Enter or Space | Copies, 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
textboxand abutton. - Accessible name
- The field from
label; the button fromlabels.copy, which changes tolabels.copiedorlabels.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
labelthat says what the value is. - Handle
onCopyErrorwhere a copy that fails would strand someone.