createField function creates and manages an individual form field in Solid applications.
Import
Signature
Parameters
A function that returns the configuration object for the field. The function is reactive and will update the field when dependencies change.
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
An accessor function that returns the field API instance.
The field name.
The current field state.
The current field value.
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.
Usage Example
Basic Field
Field with Async Validation
Nested Field
See Also
- createForm - Create and manage forms
- Field Component - Render form fields declaratively
- FieldApi - Core field API documentation