useField composable creates and manages an individual form field in Vue applications.
Import
Signature
Parameters
Configuration object for the field.
The parent form API instance.
The field name as a path string (e.g., ‘user.firstName’ or ‘items[0].name’).
The default value for the field.
Validation functions for the field.
Validator that runs on every change.
Async validator that runs on change.
Validator that runs when the field loses focus.
Validator that runs when the field is mounted.
Debounce time in milliseconds for async validation. Default is 500ms.
If true, async validation runs even if sync validation fails.
Return Value
The field API instance.
The field name.
The current field state including value, errors, and metadata.
Update the field value.
Mark the field as touched.
Add a value to an array field.
Remove a value from an array field.
A nested Field component for creating sub-fields.
A reactive reference to the field state.
The current field value.
Usage Example
See Also
- useForm - Create and manage forms
- Field Component - Render form fields declaratively
- FieldApi - Core field API documentation