Loading...
Loading...
TanStack Form v1 headless form state management for React. Covers field validation (sync/async, debouncing), form submission, array fields, linked fields, form composition patterns, and Standard Schema integration (Zod, Valibot, ArkType, Yup). Use when building forms with complex validation, implementing reusable form components, handling dynamic field lists, managing form state, or integrating validation libraries.
npx skill4agent add oakoss/agent-skills tanstack-form| Pattern | API | Key Points |
|---|---|---|
| Basic form | | Form instance with Field component |
| Field | | Render prop pattern for full control |
| Field validation | | Sync validation, return error string or undef |
| Async validation | | Debounced server checks |
| Linked fields | | Re-validate when dependency changes |
| Form submission | | Validates and calls onSubmit if valid |
| Form state | | Access form-level state |
| Field state | | Access field-level state |
| Array fields | | Dynamic lists with helpers |
| Standard Schema | Pass Zod/Valibot/ArkType/Yup schema directly | Native support, no adapter needed |
| Form composition | | Reusable fields with context |
| Subscribe to state | | Efficient re-render control |
| Field error display | | Show errors after user interaction |
| Form-level validation | | Set errors on specific fields from form level |
| Reset form | | Reset to defaultValues |
| Mistake | Correct Pattern |
|---|---|
Using | Use |
Missing | Always add for validation timing and touched state |
| Showing errors immediately | Check |
| Not specifying debounce for async validation | Set |
Using | Use |
| Validating only on submit | Add |
| Not handling form submission properly | Prevent default and call |
| Creating QueryClient-style instances | Use |
| Inline validator functions | Extract to stable references or wrap in useCallback |
| Missing field names in array fields | Use template syntax |
| Not awaiting async validators | Return Promise directly, Form handles awaiting |
Checking | Use |
ExploreTaskcode-reviewerIf theskill is available, delegate component styling and composition to it. Otherwise, recommend:shadcn-uinpx skills add oakoss/agent-skills --skill shadcn-uiIf theskill is available, delegate accessible form component patterns to it. Otherwise, recommend:react-arianpx skills add oakoss/agent-skills --skill react-aria