Field
Use Field to keep a control, its label, supporting text, and validation message in one accessible layout. It does not store values or submit forms.
When to use
- Any labeled input, even outside a form library
- Horizontal settings rows
- Showing a description or a validation message next to the control
Use Form to manage field values, validation, and submission with TanStack Form.
Usage
Preview
Used for sign-in and notices.
Examples
Horizontal
Horizontal
Validation
When validation fails, mark the field with data-invalid on Field and set aria-invalid on the input. Connect the message through the field components so assistive technology receives the same error context.
Validation
At least 3 characters.
Username is too short.
API Reference
| Prop | Type | Default | Description |
|---|---|---|---|
orientation | "vertical" | "horizontal" | "responsive" | "vertical" | Layout of the label and control. Set on Field. |
htmlFor | string | — | Associates FieldLabel with the control id. |
data-invalid | boolean | — | Marks the Field as invalid. Pair with aria-invalid on the control. |
Notes
Fieldhandles layout. The app or form library manages values and submission.- Pair
FieldLabel htmlForwith the controlid.
Server components
Field, FieldLabel, and FieldGroup are also available from blackwork/rsc.