Field
A form field wrapper that provides accessible labeling, error handling, and state management for form inputs.
Error: The 'asChild' prop is required for 'Field.Control' to function properly.
Features
- Automatic label association with form controls
- Error message display with proper ARIA attributes
- Description text support for additional context
- State management for disabled, required, readonly, and invalid states
- Seamless integration with Form component for validation
- Works with all form-related primitives (Checkbox, Select, RadioGroup, etc.) and native inputs
Installation
typo3 ui:add field
Please copy the files manually from GitHub into your project.
Read more about installing Components and Primitives.
Examples
Required Field
Mark a field as required.
With Description
Add helpful description text below the input.
Must be at least 8 characters long.
Invalid State
Indicate that the field has an error and display an error message.
The password must be at least 8 characters long.
Disabled Field
Disable the entire field.
With Checkbox
Use with the Checkbox component.
Anatomy
<primitives:field.root>
<primitives:field.label />
<primitives:field.control asChild="{true}">
<!-- Your form input here -->
</primitives:field.control>
<primitives:field.description />
<primitives:field.error />
</primitives:field.root>