TanStack

T

TanStack

TanStack is a community of passionate software engineers striving for high-quality, open-source software for web devs

Join

react-query-questions

solid-query-questions

table-questions

virtual-questions

router-questions

react-charts-questions

ranger-questions

vue-query-questions

svelte-query-questions

bling-questions

form-questions

angular-query-questions

start-questions

db-questions

start-showcase

router-showcase

📣-announcements

stormy-gold
stormy-gold7/28/2025

How is field.handleChange() work for nested fields? How is validation on nested fields handled?

I'm currently using Zod schema with nesting: ```parent: z.object({ childA: ChildASchema childB: ChildBSchema })...
wise-white
wise-white7/27/2025

Setting errors from Form Submission.

I have a form that sends an API request to an external service, which sometimes has validations that can't be matched in the frontend so when submitting I need to be able to set certain fields as errors, I read through the docs but couldn't find any way to do it. Any help is appreciated.
fascinating-indigo
fascinating-indigo7/27/2025

Can I create a form using loop from zod schemas automatically in Tanstack form?

Hi, I'm start learning about Tanstack form today, I want to create a form that have different fields generated from already zod schemas using for loop, for example if I have 100 schema and want to create a form from those shemas using for loop. Is it possible and easy using Tanstack form?
zesty-coffee
zesty-coffee7/26/2025

how to get object props in withForm(with type safetey)

I am trying to split my code. So I have a product variants array. And each variant contain options array. So in OptionList component I am trying to get variantField as a props. But it's giving type issue. How can I overcame it? ...
No description
zesty-coffee
zesty-coffee7/26/2025

withFieldGroup not return from createFormHook

in documentation it's showning there is an function called withFieldGroup. But I am not getting it. Documentation: https://tanstack.com/form/latest/docs/framework/react/guides/form-composition#reusing-groups-of-fields-in-multiple-forms...
No description
flat-fuchsia
flat-fuchsia7/26/2025

19 generics to FieldApi.. better alternatives for me?

I'm passing a field as prop to a reusable form component that is pretty lenghty and reusable in my forms (the component itself is about 400 lines and handles a lot of logic for setting open hour for a week). Attempting for useField also is the same (19 generics), and not happy about receiving a form typed as ReturnType<typeof useForm<PlaceFormValues>> (ie: const field = useField({ form, name: 'openingHours' });). For clarity, this is my current (pre updating to latest version):...
robust-apricot
robust-apricot7/24/2025

Does the defaultState property in useForm work?

Hi, I'm testing tanstack-form but something is strange. On mount, I need that the form state isFieldsValid has to be false by default to prevent user submit unfilled form at start. It seems the best way to do it is to set isFieldsValid property inside the defaultState in the useForm hooks. ...
ugly-tan
ugly-tan7/24/2025

Help with building forms with dynamic fields

Hi, I'm trying to use tanstack-form to help build a form that has dynamic elements but struggling. I have an API that returns data for the fields that looks like: ```ts const formFields = [...
confidential-salmon
confidential-salmon7/24/2025

Type of error object from useStore() using Zod

I would like to know how to tell TypeScript the type of the error object extracted from useStrore() using zod validation schema. ```ts // FormPage ...
absent-sapphire
absent-sapphire7/22/2025

Invalidate field based on other field

Maybe a stupid question, but what is the best way to invalidate a field if any other form field is switched. What I mean is: lets assume I have a required field. I chose value. Then I remove it - validation happenes and I see error. But then I switch anpther field in the form and the first field is not required anymore. What is the right way to remove the error that is still there because of first validation run?...
absent-sapphire
absent-sapphire7/22/2025

Field type for further prop autcomplete

Hello all, I have a questions. I have tanstack form created with createFormHook. I have InputFormField component provided by the form. However when I use it like on screenshot it does not show me the props my InputFormField has. So I cannot qutocomplete them. Also if some prop of this field is mandatory - linter will not spot the error. Is there a way I can strictly type it? ...
No description
flat-fuchsia
flat-fuchsia7/21/2025

Typings on validation errors for fieldComponents

I'm trying to implement Zod in my Tanstack form, but I'm struggling to find a type safe way of presenting the errors from validation. My components are FieldComponents, and I want them to have their own error presentation but the type for field.form.state.errors is an any[] (pic 1). I'm a bit confused of what I need to do differently. If I try to access it from its executive parent then the type is undefined[] (pic 2). Any help would be greatly appreciated, and I can provide any further info tha...
No description
exotic-emerald
exotic-emerald7/21/2025

How can we pass from object and it's type to child ?

i have to dynamiclly generate from based on user input so i need to pass from object currently i m doing from:any which works but reactive is not working...
absent-sapphire
absent-sapphire7/20/2025

Best practices for sharing form values between multiple forms

Hi everyone We're currently in the process of refactoring a legacy React application and are looking for best practices for sharing values between multiple forms on a single page. Use Case...
noble-gold
noble-gold7/20/2025

TanStack Form + Zod: Type error with enum default values in onChange validator

Having a TypeScript issue with TanStack Form + Zod schema validation. Getting a type error when using my schema in the onChange validator. Schema: ```ts...
genetic-orange
genetic-orange7/18/2025

Error question

I just started playing with Tanstack Form today and I have been a full time react-hook-form user for the past several years. With that library, I’ll use the form.setErrors(‘root’) property to set a custom form error message or a message returned from the server. Is there similar functionality in Tanstack Form?
quickest-silver
quickest-silver7/17/2025

Form level isDefaultValue always false.

I have code like this in my form: ``` <form.Subscribe selector={(state) => [state.canSubmit, state.isSubmitting, state.isDefaultValue]}...
foreign-sapphire
foreign-sapphire7/16/2025

Computed Fields for UI Display and Submit Data

Hello TanStack! 👋 I have a common scenario: a "total" field (e.g., "Calories") that depends on 3 other input fields ("Protein", "Fat", "Carbs"). My goal: 1. "Calories" updates and displays reactively as inputs change. 2. "Calories" value is correctly included when the form is submitted....
absent-sapphire
absent-sapphire7/16/2025

Default values from server and isDefaultValues not working as expected

Hi, I'm trying to implement unsaved changes feature in remix. I get default values from server and they are updated after form.handleSubmit. Yet isDefaultValue remains false. Similar to this issue https://github.com/TanStack/form/issues/1051 Any suggestions for a workaround. Or how to handle this bug/issue...
exotic-emerald
exotic-emerald7/15/2025

Late validation on linked field

I am facing an strange issue in my Form using zod and refine a schemaa. 1. I have this schema ``` z .number({...