Field
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 when the field needs TanStack Form state and submit.
Usage
Preview
Used for sign-in and notices.
Examples
Horizontal
Horizontal
Validation
Put data-invalid on Field and aria-invalid on the control.
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
Fieldis layout only. It does not own value or submit.- Pair
FieldLabel htmlForwith the controlid.
Server components
Field, FieldLabel, and FieldGroup are also available from blackwork/rsc.