Installation
Create your first form
Import
createForm and set up a basic form with default values and a submit handler:Understand the key concepts
createForm: A Solid primitive that creates a reactive form instance. It takes a function that returns form configuration.form.Field: A component for creating type-safe form fields. It uses a render prop pattern withchildren.field().state.value: Access the current field value through the reactive signal.field().handleChange: Update the field value when the user types.form.handleSubmit(): Submit the form and trigger theonSubmithandler.
Complete Example with Validation
Here’s a more complete example with validation from the TanStack Form repository:Next Steps
Now that you have a basic form working, explore these topics:- Basic Concepts - Learn about form instances, fields, and state management
- Validation - Add validation rules to your forms
- Arrays - Work with dynamic lists of fields