react-forms
Original:🇺🇸 English
Translated
TanStack Form v1 - type-safe forms with Zod/Yup/Valibot validation, async validation, arrays, nested fields, React 19 Server Actions
2installs
Sourcefusengine/agents
Added on
NPX Install
npx skill4agent add fusengine/agents react-formsTags
Translated version includes tags in frontmatterSKILL.md Content
View Translation Comparison →TanStack Form v1 Core Features
Agent Workflow (MANDATORY)
Before ANY implementation, use to spawn 3 agents:
TeamCreate- fuse-ai-pilot:explore-codebase - Analyze existing form components and validation patterns
- fuse-ai-pilot:research-expert - Verify latest TanStack Form v1 docs via Context7/Exa
- mcp__context7__query-docs - Check Zod validation and React 19 Server Actions patterns
After implementation, run fuse-ai-pilot:sniper for validation.
MANDATORY: SOLID Principles
ALWAYS apply SOLID principles from skill.
solid-react→ See for complete rules
../solid-react/SKILL.mdKey Rules:
- Files < 100 lines (split at 90)
- Interfaces in
modules/[feature]/src/interfaces/ - JSDoc mandatory on all exports
- No business logic in components
Core Hooks
| Hook | Purpose | Guide |
|---|---|---|
| Initialize form with validation | |
| Subscribe to individual field | |
| Render prop component for fields | |
| Watch form state changes | |
→ See for detailed usage
references/tanstack-form-basics.mdValidation Adapters
| Library | Adapter | Bundle Size |
|---|---|---|
| Zod | | ~12KB |
| Yup | | ~40KB |
| Valibot | | ~6KB |
→ See for Zod patterns
→ See for alternatives
references/zod-validation.mdreferences/yup-valibot.mdKey Features
Async Validation
Server-side checks with debouncing and loading states.
→ See
references/async-validation.mdServer Actions (React 19)
Integration with useActionState and progressive enhancement.
→ See
references/server-actions.mdArrays & Nested Fields
Dynamic field arrays and dot notation for nested objects.
→ See
references/arrays-nested.mdTypeScript Integration
Full type inference from Zod schemas and defaultValues.
→ See
references/typescript.mdshadcn/ui Integration
Field wrapper components with shadcn styling.
→ See
references/shadcn-integration.mdListeners (Side Effects)
onMount, onChange, onBlur, onSubmit with debouncing.
→ See
references/listeners.mdLinked Fields
Cross-field validation and dependent dropdowns.
→ See
references/linked-fields.mdReactivity & Performance
useStore selectors and granular subscriptions.
→ See
references/reactivity.mdReset API
Form and field reset with custom values.
→ See
references/reset-api.mdSSR & Hydration
TanStack Start integration and server state merge.
→ See
references/ssr-hydration.mdDevtools
Debug form state with @tanstack/react-form-devtools.
→ See
references/devtools.mdReact Native
Mobile-specific patterns with TextInput.
→ See
references/react-native.mdStandard Schema
ArkType and Effect Schema support.
→ See
references/standard-schema.mdTemplates
| Template | Use Case |
|---|---|
| Login/signup with Zod |
| Wizard with step validation |
| Add/remove field arrays |
| File input with preview |
| React 19 Server Actions |
| useOptimistic integration |
| Dot notation nested fields |
| Debounced search |
| Show/hide based on values |
| Reusable field components |
| Side effects & auto-save |
| Cross-field validation |
| Performance optimization |
| Form/field reset patterns |
| SSR & hydration |
| Devtools integration |
| React Native forms |
Best Practices
- Validation: Use Zod/Yup/Valibot, NOT custom regex
- Async: Debounce server validation (300-500ms)
- Errors: Display
field.state.meta.errors - Nested: Use dot notation ()
address.street - Arrays: Use with pushValue/removeValue
mode="array" - TypeScript: Infer types with
z.infer<typeof schema>
Forbidden (Anti-Patterns)
- ❌ for form state → use
useStateuseForm() - ❌ Regex validation → use Zod/Yup/Valibot
- ❌ No debounce on async → use
onChangeAsyncDebounceMs - ❌ Validation in components → move to schema
- ❌ Direct → use
onChangefield.handleChange - ❌ No TypeScript types → use
z.infer<typeof schema>