Field
Associates a label, control, description, and validation error for a form field.
Used to send you order updates.
Installation
Bash
Usage
Field wires everything together for you: htmlFor/id between label and
control, aria-describedby for the description and error, and
aria-invalid on the control are all managed by the underlying Base UI
Field context — no manual ids. Every SevenUI form control (Input, Textarea,
Checkbox, Radio Group, Select, Switch, Slider, Number Field, …) participates
automatically.
Examples
Orientation
horizontal places the label and control on one row — pair it with
FieldContent to stack a label and description beside the control.
responsive stacks in narrow containers and switches to the horizontal
layout from the @md container breakpoint; it requires a FieldGroup
ancestor, which provides the container query scope.
Occasional product news. No spam.
Stacks on narrow containers, inline on wide ones.
Validation
A bare <FieldError /> renders the field’s active error on its own —
native constraint messages (required, type="email", …), messages
returned by validate, or server errors passed through
Form. This example validates on blur with a custom
validate function.
Validates when the input loses focus.
To scope a literal message to one native validity state, use match:
React Hook Form
Any form library can drive a field through three generic props — invalid,
touched, and dirty — plus the errors array on FieldError. With
react-hook-form, spread fieldState from a Controller:
The same pattern works for TanStack Form
(field.state.meta.isTouched, field.state.meta.errors) or any validator
implementing Standard Schema — the component has no form-library imports.
API reference
Field
Extends the Base UI Field Root — all its props apply.
| Prop | Type | Default |
|---|---|---|
orientation | "vertical" | "horizontal" | "responsive" | "vertical" |
name | string — keys the field for form submission and Form errors | — |
validate | (value, formValues) => string | string[] | null | Promise<...> | — |
validationMode | "onSubmit" | "onBlur" | "onChange" | "onSubmit" |
invalid / touched / dirty | boolean — for external form libraries | — |
disabled | boolean — supersedes the control’s own disabled | false |
Every part carries the field’s state as data attributes for styling:
data-invalid, data-valid, data-dirty, data-touched, data-filled,
data-focused, data-disabled.
FieldLabel
Extends the Base UI Field Label — associated with the field’s control
automatically, no htmlFor needed. Renders through
Label, so label styling applies. Wrapping a
nested Field turns it into a selectable card (checkbox/radio card
patterns).
FieldDescription
Extends the Base UI Field Description — linked to the control via
aria-describedby automatically.
FieldError
Extends the Base UI Field Error. Visible only while the field is invalid, unless external content forces it.
| Prop | Type | Default |
|---|---|---|
errors | Array<{ message?: string } | undefined> | — |
match | boolean | keyof ValidityState | — |
With no props it auto-renders the field’s active error from context.
errors accepts issues from any form library or Standard Schema validator
(Zod, Valibot, ArkType); messages are deduped, and multiple messages render
as a list. match="valueMissing" (and other
ValidityState
keys) scopes literal children to one native validity condition.
Layout parts
Plain styled elements with no form wiring — compose freely around any number of fields:
| Component | Description |
|---|---|
FieldSet | <fieldset> grouping related fields. |
FieldLegend | <legend>; variant: "legend" (default) or "label". |
FieldGroup | Vertical stack of fields; container-query scope for responsive. |
FieldContent | Column wrapper pairing a label/description beside a control. |
FieldTitle | Label-styled heading for non-label contexts. |
FieldSeparator | Divider between fields, with optional inline content. |