tanstack-form

Implements type-safe form state management with validation using TanStack Form in React applications.

Updated Aug 15, 2025
One-click install
npx skills add https://github.com/yehezkieldio/topaz --skill tanstack-form-yehezkieldio
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: tanstack-form
Source: https://github.com/yehezkieldio/topaz/tree/main/v3-tether/.agents/skills/tanstack-form
Command: npx skills add https://github.com/yehezkieldio/topaz --skill tanstack-form-yehezkieldio

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires @tanstack/react-form, @tanstack/zod-form-adapter, @tanstack/valibot-form-adapter.

What problem does it solve? Building forms in React requires managing field state, validation timing, async checks, array fields, and cross-field dependencies, which leads to boilerplate and bugs when done manually. ## Core Features & Use Cases - Field and Form Validation: Run synchronous, asynchronous, and schema-based (Zod/Valibot) validators at change, blur, mount, or submit time. - Array and Nested Fields: Manage dynamic lists with push, insert, remove, swap, and move operations plus dot-notation nested paths. - Fine-Grained Reactivity: Subscribe to specific form state slices with form.Subscribe selectors to avoid unnecessary re-renders. - Use Case: Build a registration form where the username field checks availability via a debounced async API call, the confirm-password field revalidates whenever the password changes, and the submit button disables itself until the form is valid. ## Quick Start Ask the AI to create a validated signup form using TanStack Form with Zod schema validation and a debounced async username availability check.

Frequently Asked Questions about tanstack-form

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I add validation to a TanStack Form field?

Add a validators object to form.Field with keys like onChange, onBlur, or onSubmit. Each validator returns an error message string for invalid input or undefined for valid input, and you can combine multiple timing triggers per field.

How to use Zod schemas with TanStack Form?

Install @tanstack/zod-form-adapter and pass zodValidator() as the validatorAdapter in useForm. Then assign Zod schemas directly to field validators, such as z.string().email() for an onChange validator.

Does TanStack Form support async validation?

Yes, use onChangeAsync or similar async validators and set asyncDebounceMs on the field to limit API calls. The field state exposes isValidating so you can show a loading indicator while the check runs.

How do I validate dependent fields like confirm password?

Use onChangeListenTo on the dependent field to re-run validation when another field changes, then read the other value with fieldApi.form.getFieldValue inside the validator. Alternatively, use a form-level validator comparing both values.

Why does my TanStack Form submit reload the page?

The form's onSubmit handler must call e.preventDefault() and e.stopPropagation() before invoking form.handleSubmit(). Without preventDefault, the browser performs a native form submission and reloads the page.

How do I handle dynamic array fields in TanStack Form?

Set mode="array" on the parent form.Field, then use field.pushValue, removeValue, insertValue, swapValues, and moveValue to manipulate items. Sub-fields are addressed with indexed paths like people[0].name.