What this thread does
The problem
You prefer TanStack Form to React Hook Form (typed field state, validators per event) and want an agent to wire it to shadcn components without mixing the two libraries' patterns.
What the sources say
shadcn/ui's TanStack Form guide (shadcn-ui/ui, MIT) states its approach: useForm for state, form.Field with a render prop for controlled inputs, Field components for accessible markup, Zod for validation and real-time feedback. The flow is the same three steps: create a schema, call useForm with validators: { onSubmit: schema } and an onSubmit handler that receives the validated value, then build the fields. You can add onChange and onBlur validators next to onSubmit to change when errors appear. The guide's text calls validation real-time, but its basic examples set only validators: { onSubmit } and gate display on isTouched && !isValid, so real-time feedback needs the onChange validator you add yourself. For errors, set data-invalid on Field, aria-invalid on the input, and render FieldError with field.state.meta.errors.
TanStack Form itself (TanStack/form, MIT) has an AGENTS.md aimed at contributors, not at app builders, so it does not teach agents the API.
How to describe it to the agent
Use TanStack Form (not React Hook Form) with shadcn's Field components, following shadcn's TanStack Form guide. Zod schema for the whole form invalidators.onSubmit; addonBlurso errors show after leaving a field. Each input usesform.Fieldwith a render prop:isInvalidfrom the field meta,onBlur={field.handleBlur},onChangecallingfield.handleChange,aria-invalid, and aFieldErrorforfield.state.meta.errors. Do not import react-hook-form.
Mistakes to check
- Mixed libraries:
Controllerfrom React Hook Form inside a TanStack form. - Handlers that bypass
field.handleChange, so state and display drift apart. - Errors shown while the field is untouched; check
isTouchedor only validate on blur.
Limits
Not run by me. If your project already uses React Hook Form, stay with it; the guides are parallel, not better or worse.
Primary source
Primary source: shadcn/ui TanStack Form guide (shadcn). Checked: useForm, form.Field render prop, Field components, Zod, the three steps, validators.onSubmit, optional onChange and onBlur validators, data-invalid, aria-invalid and FieldError with field.state.meta.errors. TanStack Form’s AGENTS.md was also checked on 2026-11-15 and directs contributors to CONTRIBUTING.md.
Started from a post by @shadcn/ui maintainers, packaged by the editor. Original post