Field
Label placement, help text, grouping and validation semantics for any control — the half of a form that is not state.
Field
The stack a form is made of: a `FieldGroup` of `Field`s, each pairing one label with one control and the sentence that helps a reader fill it in. Reach for this shape rather than a `div` with vertical spacing — the gaps, the label placement and the grouping then come from one decision instead of being re-guessed per surface.
Usage
import {
Field,
FieldContent,
FieldDescription,
FieldError,
FieldGroup,
FieldLabel,
FieldLegend,
FieldSeparator,
FieldSet,
FieldTitle,
} from '@oceanic-hub/brand-system'<FieldGroup>
<Field>
<FieldLabel>…</FieldLabel>
<FieldDescription>…</FieldDescription>
</Field>
<FieldSeparator>…</FieldSeparator>
<FieldSet>
<FieldLegend>…</FieldLegend>
<Field>
<FieldContent>
<FieldTitle>…</FieldTitle>
<FieldDescription>…</FieldDescription>
</FieldContent>
</Field>
</FieldSet>
</FieldGroup>Composition
Use the following composition to build a Field:
FieldGroup
├── Field ×4
│ ├── FieldLabel ×3
│ ├── FieldDescription
│ ├── FieldError
│ └── FieldContent
│ ├── FieldTitle
│ └── FieldDescription
├── FieldSeparator
├── FieldSet
│ ├── FieldLegend
│ ├── Field ×2
│ │ ├── FieldContent
│ │ │ ├── FieldTitle
│ │ │ ├── FieldDescription
│ │ │ └── FieldLabel
│ │ └── FieldLabel
│ ├── FieldDescription
│ └── FieldLabel
│ └── Field
│ └── FieldContent
│ ├── FieldTitle
│ └── FieldDescription
└── FieldDescription
Field
└── FieldLabelReach for it the moment a form has more than one control. FieldGroup > Field > FieldLabel replaces the div with vertical spacing that every surface otherwise reinvents at
a slightly different set of gaps, and FieldSet + FieldLegend is what makes a set of
related radios or checkboxes one announced thing rather than several loose ones. It wraps any
control — Input, Textarea, an InputGroup, a Checkbox or Switch row, a
RadioGroup, a SelectTrigger — and the sections below are the composed shape each of those
pages points at.
It is a complement to Form, not a rival, and the split is the one thing here worth
getting right. Form owns STATE: it is the react-hook-form wrapper, and the generated ids
that let a control announce its own description and error. Field owns LAYOUT and the
validation semantics a layout has to express. So a Field holds nothing — there is no
name, no control, no value anywhere in these parts, and asking for one is a
compile error rather than a prop that renders beautifully and validates nothing. A settings
screen with three inputs and no validation wants Field alone; a form with a resolver wants
both, with FormField rendering a Field.
FieldTitle is not a second FieldLabel. Use FieldLabel when this IS the control's
<label> and htmlFor points at it; use FieldTitle for the heading line of a
FieldContent whose control is already labelled by the row around it. And a row that can be
invalid is a Field rather than an Item — validity is the whole test, which is how
Item's note puts it from the other side.
Invalidity is stated three times and coloured never. data-invalid goes on the
Field and paints the CONTROL's border solid stuck — any control, since the rule names the
roles the accessibility tree already carries rather than the two tags it used to name, so a
Select, a Switch, a radio, a checkbox and a slider's thumb all redden (@OCE-1877);
aria-invalid goes on the control itself, because that is where assistive tech reads it, and it
paints the same border on its own, so a bare control outside a Field is not a silent one;
FieldError says what is wrong, in ink beside a stuck mark. None of the three is red prose —
a status tone measures 4.03:1 as body text, which is below AA on the one string in a form nobody
can skip. Two mechanical caveats worth knowing before you meet them: data-invalid is reachable
only in JSX attribute position, so a caller assembling props programmatically cannot spread it in;
and an InputOTP's slots are divs with no role, so they read the root's aria-invalid
themselves rather than being reached by this selector.
orientation="responsive" measures the FieldGroup, not the viewport. A Field inside a
320px drawer therefore stays stacked on a wide screen, which is the only answer that survives
being reused somewhere narrower.
One alignment rule upstream has and we do not. A horizontal Field whose content is a
title-and-description stack does not top-align itself, because nothing this package emits
distinguishes a FieldContent from any other div. Write className="items-start" on
the Field; that is the whole fix, and it is a deliberate trade rather than an oversight.
A Slider field labels sideways, and it is the one composition here that does. Every other
control takes FieldLabel htmlFor; a Slider cannot, because Radix names the control from
its THUMB and the root is a span, which no <label> can point at. So the label carries the
words, the thumb points back at it with thumbProps={{ 'aria-labelledby': … }}, and the
association is real rather than assumed (@OCE-1873). A range slider names each end.
One upstream example is refused rather than left silent. RTL is not supported — the same
refusal Accordion and Item carry, recorded in pairings.json under direction:
nothing in this package has ever been laid out or measured right-to-left.
Legend weight
FieldLegend comes at two weights. The default, legend, is the heading a FieldSet announces; variant="label" is the house eyebrow, for a nested set that is really one labelled control group. Reach for the quiet one when a second heading size would out-shout the fields.
Radio group
A RadioGroup as the direct child of a FieldSet tightens the fieldset's own row gap from 24px to 12px — legend, group and description all close up — because a set of mutually exclusive choices reads as one control rather than as several fields. The group's internal spacing is unchanged. Each option is a horizontal Field, so the label — not just the 16px dot — is the hit target.
Applies to this campaign only. The workspace default is set in Settings.
Switch row
Put the FieldContent first and the control last when the control is a switch: a switch commits on the spot, so the reader should have finished reading before the toggle is under their thumb. A checkbox row is the other order, because a checkbox is answered and then saved.
Choice card
A FieldLabel whose direct child carries data-orientation becomes a selectable card: it grows a hairline box, pads that child, and takes the brand's soft fill while a control inside it reports itself checked. A Field always stamps that attribute, which is the composition shown here — but so do RadioGroup, Slider, Tabs and ToggleGroup, so the treatment is keyed to the attribute rather than to a Field. Reach for it when the options need a sentence each to be chosen between.
Select
A Field wraps any control, not just an Input — the shape does not change. What does change is the wiring: a SelectTrigger is a button, so it takes the id the FieldLabel points at, and the SelectValue inside it carries the placeholder.
Slider
A slider's name lives on its thumb, so the FieldLabel carries the words and the thumb points at them with aria-labelledby — htmlFor cannot make this association, because the control's root is a span and a span is not a labelable element.
Responsive
orientation="responsive" stacks the label over the control until its FieldGroup is wide enough for a row, and it measures that GROUP rather than the window. The same Field is drawn twice below, in a narrow container and a wide one, with nothing but the container changed. orientation="horizontal" is the fixed version of the row this one chooses when it fits — the switch and radio sections above are both that value, named.
In a 320px container the label keeps its own line.
In a 512px container the same Field becomes a row.
Invalid
data-invalid goes on the Field and paints the CONTROL's border solid stuck — any control, because the rule names the roles the accessibility tree carries rather than two element names, so a Select, a Switch, a radio, a checkbox and a slider's thumb all redden. The prose is never recoloured, because a status tone measures 4.03:1 as text; FieldError is what says what is wrong — one message renders as a sentence, several as a list, none as nothing.
Invalid, on any control
One data-invalid reaches a SelectTrigger, a Switch, a radio and a slider's thumb, because the rule names the roles the accessibility tree already carries rather than two element names — so no control in a form is the one that stays silent when it is wrong. aria-invalid still goes where assistive technology reads it, which for a radio set is the group and not each option.
Disabled
FieldSet is a real fieldset, so disabled on it switches off every control inside — the browser-native way to close a whole group, and the reason this part is not a div with a heading. data-disabled on a single Field fades that Field's own label and title with it.
Available on Scale. Everything here is read-only until then.
API Reference
See the Field API page for every prop of every part, with types, defaults and the contract that pins them. It also documents fieldVariants — exported alongside the parts, and signatures rather than props.