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

quickest-silver
quickest-silver11/24/2025

Validate Form but not submitting

Is there a way to validate the input without submitting the form? already tried this ```ts <Button className="flex-1"...
gentle-gray
gentle-gray11/23/2025

Always trigger onSubmit even when the form is invalid?

Hey there, Is there a way to always trigger onSubmit even when the form is invalid. I kind of expected setting the canSubmitWhenInvalid argument would have this effect, but it only has an effect on the canSubmit flag. I could just use the same function for onSubmitInvalid, but then I do have to manage some of the form state myself which is not ideal I would prefer to use the submission state variables....
xenial-black
xenial-black11/21/2025

What is the recommandation for composition, AppForm provider and DOM form element?

Hi TanStack team! Context: • createFormHook to compose our UI components into the form hook. • createFormHookContexts to get formContext and fieldContext for our provider/consumers....
adverse-sapphire
adverse-sapphire11/21/2025

What’s the best way to write unit tests for a form?

I’ve been building a sign up form with this and was wondering what the right way is to write unit tests for testing the logic performed on submission and form validation?
fair-rose
fair-rose11/19/2025

TanStack Form together with TanStack Virtual

I have a form with several hundred fields. For performance reasons, I therefore use TanStack Virtual. Since not all fields are mounted all the time, I use a global async onChange form validation function to achieve overall validation. But now I face the problem, that only the fields which are at least mounted one time are registered in the form. The Form validation returns all invalid fields, but only the currently known fields in the form get the invalid state. And when I scroll down to fields which never where mounted before, they have (incorrectly) the valid state until the next field change which triggers the validation function again. So the question I have: - Is my concept generally wrong or bad? - How can I make the form fields gradually gets visible while scrolling uses the validation instantly and not only after any field change?...
conscious-sapphire
conscious-sapphire11/18/2025

What is the best way to create a multistep form?

Would be awesome to have an example in thedocs. I have tried a few different ways but none seem great. The most promising one was to use on submit + validators on the individual fields. But this doesn't work because if the user navigates to page 2, doesn't fill anything out then goes back to page 1. He is now locked out of the form because the page 2 fields are in the form state.......
national-gold
national-gold11/18/2025

child forms with multi-steps

Hello, I'm looking to build a big form with a bunch of image upload in the middle of the form. let's say: - input type=text...
rival-black
rival-black11/18/2025

withForm usage questions

I was trying to use withForm for the first time now that we are starting to get into some more complex forms and might go back and break up some of our others after messing around with it a bit. But I am running into what seems like a bug but I might be missing something. Wasn't able to find any information related to this though so unsure. https://stackblitz.com/edit/tanstack-form-6y8wrlas?file=src%2Findex.tsx Here in my demo if you uncomment the onSubmitAsync I start to get some typing issues on the FirstNameField props. Is this a bug? Or if expected how can I fix this here....
wise-white
wise-white11/17/2025

Revalidate array field on array items update

I have an array field with a validator: ```tsx <form.Field name="commissionPayablePercentages" mode="array"...
conscious-sapphire
conscious-sapphire11/17/2025

Using state, properties, or router to track an "actively selected?"

Hey everyone, i have a very quick question about what the best way to go about this is. I have quite a nested form where one can edit a module, as well as its lessons, and its exercises too. I've been using tanstack router with search params to determine selected state and soforth, but i run into a small issue when deleting items where before deleting i'd have to first navigate to the next/previous item before deleting (otherwise the param is broken). I attached a small example of how the form looks, i hope it makes sense. I was thinking of using state and soforth but from what i understood on other posts its a bit tricky and requires a bit of prop drilling (if it will be like a 5 or 6 components deep)....
No description
rival-black
rival-black11/17/2025

Validation error type safety when using form composition

Is there any way to pass a type down for validation errors when using form composition? Looks like it comes back as any through useFieldContext, but for instance I know I'll always use Zod and so it should always be a ZodError in my case
inland-turquoise
inland-turquoise11/14/2025

useSyncExternalStoreWithSelector error with version 1.25.0

I have this error when I updated to 1.25.0, I had to downgrade to 1.23.9 for the time being: The requested module '/node_modules/.pnpm/use-sync-external-store@1.6.0_react@19.2.0/node_modules/use-sync-external-store/shim/with-selector.js?v=f475a158' does not provide an export named 'useSyncExternalStoreWithSelector'...
sensitive-blue
sensitive-blue11/14/2025

Why do array form elements not register invalid state?

I am using arrays and the form state shows there is an error for this field, but the field thinks it's still valid. Is this a bug?
No description
stormy-gold
stormy-gold11/13/2025

plugin form-devtools : Bus not available

I'm using tanstack-start + tanstack-query + tanstack-forms .. and i dont't have the forms dev tools plugin .. i only have tanstack query dev tools things are working fine but i get those logs in both development and production can you tell me what are those logs saying untill i can provide a minimal example ?...
No description
sensitive-blue
sensitive-blue11/13/2025

How to use dev tool with form and query both?

I try to use both query and form dev tools in same time but it is overlap. How to use both? ```js createRoot(document.getElementById("root")!).render( <StrictMode>...
extended-salmon
extended-salmon11/12/2025

pushValue argument type confusion

Hi everybody, i am currently working on a project which revolves around a form to add recipes. Therefore I thought this might be the perfect opportunity to dive deeper in the TanStack with forms. I used this library before with a simple form in Angular. My new project now is in React with Tanstack Start. Now to my question abut pushValue. I have a field where its counterpart in the Forms state is a string array. Therefore I figured out that I can add entries to this array using field.pushValue() like field.pushValue("hi"). Now the Function signature is confusing me a bit because it is showing string array variations for the type of the argument value. ...
No description
sensitive-blue
sensitive-blue11/12/2025

How to fields disable when form submitting?

This is my reusable code and i try to add disable when submitting but it is not working. It update as true when submit click but not update again to false when validation error or submit finished. I used this code to check it - {"Subminiting?:" + (field.form.state.isSubmitting === true ? "Yes" : "No")} ```Javascript...
grumpy-cyan
grumpy-cyan11/11/2025

Pass partial form to onBlurAsync

I'm using the form composition API. I have onBlurAsync defined in my validators. This is cool, but it validate the entire form when any field is blurred. Instead, I want to be able to only validate that field (or optionally pass other fields that should validate at the same time) How can I do this? I'd rather not have to define validators on the field level if possible...
other-emerald
other-emerald11/8/2025

NullableInput Helper function not working

I'm trying to use the nullableInput helper function that has been shared a few times ``` export function nullableInput<TSchema extends ZodTypeAny>(schema: TSchema) { return schema.nullable().transform((value, ctx: RefinementCtx) => {...
Next