FieldLayout
Field layout: a container that places a field control together with its label — the basic unit inside a FormLayout.
Basic usage
The label/control association is done automatically: an input control placed inside FieldLayout claims an id, and the label's htmlFor points at it, so clicking the label focuses the control and screen readers read the label. The field control itself does not need to set label.
Alignment
align decides how the label and control are laid out: left (default, label on the left), right (label on the right), top (label above), and inline (label and control on the same line, commonly for checkboxes and radios). Passing inline is not auto-downgraded (the original falls back to top when the field root element isn't a span); make sure the field root element is inline before passing it.
Label and tooltip
labelis the label content (ReactNode).invisibleLabelhides the label visually but keeps the accessible name; thentitlefalls back to the label text when not given explicitly.titlelands on the label element (matching the original$titled = $label), not on the layout root.- When the field control registers its own
accessKey, the label tooltip gets the key appended (the chord text can be localized via OOUIProvider).
Disabled
FieldLayout's disabled only adds the oo-ui-fieldLayout-disabled style class to the layout root, giving the field area a disabled look — it does not disable the control in children for you. To actually disable it, set disabled on the control itself; to disable a whole group, use FieldsetLayout, which relies on a native <fieldset disabled>.
API
See also
- The form container that wraps several
FieldLayouts: FormLayout - Props and landing spots of the controls: TextInput, CheckboxInput
- The
disabled,titleandaccessKeysemantics shared by all components: Common props