Field
The layout and accessibility shell every form control in heyo-ui composes.
Loading documentation…
Lowercase letters, numbers and dashes.
Field is the label, the description, the error and the wiring between them.
Every input-like component in heyo-ui composes it, which is why a label looks
and behaves identically whether it sits above an Input, a Select or a
NumberField.
Most of the time you never render it: Input, Textarea, NumberField and
OtpField take label, description and error directly and build the field
for you. Reach for Field when the control inside is your own, or when it is
one heyo-ui does not wrap — a Select, a Slider, a group of checkboxes.
error takes a ready-made message, or a rule tied to the browser's own
ValidityState. A truthy error also flips the control into its invalid state,
and the description steps aside while the message is up — two lines of
competing text under one input is one too many.
At least 8 characters.
optional adds a muted marker to the label — the inverse of shouting with an
asterisk. In a form where most fields are required, marking the two that are
not is quieter and more useful than marking the eight that are.
labelAside fills the right end of the label row — a character counter, a
"Forgot password?" link, a hint about the format.
Renders a <label> above the control and wires htmlFor and id for you.
Muted helper text below the control. Hidden once an error takes over.
A message, or { message, match } where match is true or a key of
ValidityState such as "tooShort" or "valueMissing". Truthy values
also flip the control into its invalid state.
Adds a muted "Optional" marker next to the label.
A right-aligned slot on the label row.
Forces the invalid state without a message.
Passed through to Base UI's field, which uses it for form validation.
Applied to the wrapper, not to the control.
The control.
The two message slots, exported for bespoke layouts — a description beside the control rather than under it, say.
The raw Base UI primitives (FieldPrimitive.Root, .Label, .Control,
.Description, .Error), re-exported as an escape hatch for a layout the
shell cannot express.