Field

Wrap any control in a Field and it gets a label that points at it, a hint and an error announced with it, and an invalid state it reports itself. None of that is passed by hand.

Reach for it

Any labelled form control. It owns the id, the description wiring and the invalid state.

Not for

A control that carries its own visible label, unless you set isControlLabelled.

Label, hint and error

The control reads the wiring from the Field rather than taking an id, so a labelled and correctly-invalid control is what you get by default rather than what you get if you remember. Every control in this family works inside one.

As registered

This IBAN is not valid

A form, validating

Submit it empty. The errors, the invalid states and the announcements are real, so this is what a screen reader hears rather than a picture of it.

Shown on the debtor invoice

Optional, up to 500 characters

Mandate

API reference

Field

PropTypeDefaultDescription
label*string-Visible label text. Required: an unlabelled control is a bug, not a style.
children*ReactNode-
data-testidstring-Names the element for a test. Never rendered, never announced.
hintstring-Guidance shown under the control. Announced with it.
errorstring-Validation message. Its presence is what marks the field invalid.
isRequiredboolean-
isLabelHiddenboolean-Visually hides the label while keeping it available to screen readers.
isControlLabelledboolean-The control carries its own visible label, as Checkbox and Switch do. Field then names a group rather than the control, because two labels pointing at one control concatenate into a single confusing accessible name: "Mandate I agree to the direct debit mandate".