CopyTextLayout
A copy-text layout: a read-only field with a copy button; the text is selected automatically when the field gains focus or the button is clicked. Suits read-only content the user needs to copy — links, embed codes and the like.
Basic usage
copyText is the text to copy (the field's initial value); onCopyResult fires when the copy attempt ends, with whether it succeeded.
Dynamic text
copyText serves only as the field's initial value, and what gets copied is the field's current value. For share links that change with the user's choices, pass the controlled value via textInputProps={{ value }} (it wins over copyText) — updating copyText alone won't refresh the field.
Multiline
multiline switches the field to the multi-line form and moves the copy button below, aligned right.
Copying prefers navigator.clipboard, falling back to document.execCommand('copy') when unavailable or permission-denied (the original uses only the latter, a deprecated API that fails silently).
API
Inherits all FieldLayout props (label / align / title, etc.), plus:
See also
- Field arrangement and label wiring: FieldLayout
- A plain action button beside an input field: ActionFieldLayout