Open History to see the last commit
1---
2id: FormState
3title: FormState
4---
5β
6Defined in: [FormApi/FormApi.public.ts:426](https://github.com/TanStack/form/blob/main/packages/form-core/src/FormApi/FormApi.public.ts#L426)
7β
8A snapshot of current values, validation status, and submission metadata.
9β
10Read the latest snapshot from `formApi.state` or subscribe to
11`formApi.atom`.
12β
13## Type Parameters
14β
15### TFormData
16β
17`TFormData`
18β
19Library-managed. Do not specify explicitly.
20β
21### TFormErrorTypes
22β
23`TFormErrorTypes` *extends* [`FormErrorTypes`](FormErrorTypes.md)
24β
25Library-managed. Do not specify explicitly.
26β
27## Properties
28β
29### canSubmit
30β
31```ts
32canSubmit: boolean;
33```
34β
35Defined in: [FormApi/FormApi.public.ts:504](https://github.com/TanStack/form/blob/main/packages/form-core/src/FormApi/FormApi.public.ts#L504)
36β
37Whether no submission is running and validation state has no known errors.
38β
39This is optimistic: validation does not need to have run, and pending
40validation alone does not make it `false`. `handleSubmit()` still runs
41submission validation.
42β
43* Equivalent to `isValid && !isSubmitting`.
44β
45***
46β
47### errors
48β
49```ts
50errors: FormErrors<TFormErrorTypes>;
51```
52β
53Defined in: [FormApi/FormApi.public.ts:478](https://github.com/TanStack/form/blob/main/packages/form-core/src/FormApi/FormApi.public.ts#L478)
54β
55Form-level errors from validators and `onSubmit`.
56β
57Errors are flattened in validator order, with `onSubmit` errors last.
58Errors routed to fields are exposed through the corresponding field APIs
59and are not included here.
60β
61***
62β
63### isDefaultValue
64β
65```ts
66isDefaultValue: boolean;
67```
68β
69Defined in: [FormApi/FormApi.public.ts:470](https://github.com/TanStack/form/blob/main/packages/form-core/src/FormApi/FormApi.public.ts#L470)
70β
71Whether current values deeply match `formApi.defaultValues`.
72β
73Unlike `isDirty` and `isPristine`, this compares current values with their
74defaults rather than tracking whether edits have occurred. Reverting an
75edit can make it `true` while `isDirty` remains `true`.
76β
77***
78β
79### isDirty
80β
81```ts
82isDirty: boolean;
83```
84β
85Defined in: [FormApi/FormApi.public.ts:451](https://github.com/TanStack/form/blob/main/packages/form-core/src/FormApi/FormApi.public.ts#L451)
86β
87Whether a value update has marked state as dirty.
88β
89This records whether a dirty-marking update has occurred, not whether
90current values match their defaults. Once `true`, it remains `true` even if
91values return to their defaults. `formApi.reset()` clears it.
92β
93* Equivalent to `!isPristine`.
94* Use `isDefaultValue` to check whether current values match their defaults.
95β
96***
97β
98### isInvalid
99β
100```ts
101isInvalid: boolean;
102```
103β
104Defined in: [FormApi/FormApi.public.ts:494](https://github.com/TanStack/form/blob/main/packages/form-core/src/FormApi/FormApi.public.ts#L494)
105β
106Whether validation state contains at least one form- or field-level error.
107β
108This is the exact inverse of `isValid`. Field `errorVisibility` does not
109affect it.
110β
111* Equivalent to `!isValid`.
112β
113***
114β
115### isPristine
116β
117```ts
118isPristine: boolean;
119```
120β
121Defined in: [FormApi/FormApi.public.ts:462](https://github.com/TanStack/form/blob/main/packages/form-core/src/FormApi/FormApi.public.ts#L462)
122β
123Whether state has not been marked dirty.
124β
125This records whether a dirty-marking update has occurred, not whether
126current values match their defaults. Once `false`, it remains `false` even
127if values return to their defaults. `formApi.reset()` restores it.
128β
129* Equivalent to `!isDirty`.
130* Use `isDefaultValue` to check whether current values match their defaults.
131β
132***
133β
134### isSubmitSuccessful
135β
136```ts
137isSubmitSuccessful: boolean;
138```
139β
140Defined in: [FormApi/FormApi.public.ts:519](https://github.com/TanStack/form/blob/main/packages/form-core/src/FormApi/FormApi.public.ts#L519)
141β
142Whether the latest completed submission finished without validation errors
143or an `onSubmit` failure.
144β
145It starts as `false`, updates when an attempt finishes, and is cleared by
146`formApi.reset()`.
147β
148***
149β
150### isSubmitting
151β
152```ts
153isSubmitting: boolean;
154```
155β
156Defined in: [FormApi/FormApi.public.ts:511](https://github.com/TanStack/form/blob/main/packages/form-core/src/FormApi/FormApi.public.ts#L511)
157β
158Whether a submission attempt is in progress.
159β
160This includes submission validation and the time spent awaiting `onSubmit`
161or `onSubmitInvalid`.
162β
163***
164β
165### isTouched
166β
167```ts
168isTouched: boolean;
169```
170β
171Defined in: [FormApi/FormApi.public.ts:440](https://github.com/TanStack/form/blob/main/packages/form-core/src/FormApi/FormApi.public.ts#L440)
172β
173Whether at least one field is currently touched.
174β
175Field changes mark fields as touched by default, and submission marks all
176registered fields as touched. Resets clear the touched state.
177β
178***
179β
180### isValid
181β
182```ts
183isValid: boolean;
184```
185β
186Defined in: [FormApi/FormApi.public.ts:485](https://github.com/TanStack/form/blob/main/packages/form-core/src/FormApi/FormApi.public.ts#L485)
187β
188Whether validation state contains no form- or field-level errors.
189β
190* Equivalent to `!isInvalid`.
191* A field error hidden by `errorVisibility` still makes this `false`.
192β
193***
194β
195### isValidating
196β
197```ts
198isValidating: boolean;
199```
200β
201Defined in: [FormApi/FormApi.public.ts:526](https://github.com/TanStack/form/blob/main/packages/form-core/src/FormApi/FormApi.public.ts#L526)
202β
203Whether any form-, group-, or field-level validation is pending.
204β
205It remains `true` until all concurrent validation work finishes or is
206canceled. Pending validation does not by itself make `canSubmit` `false`.
207β
208***
209β
210### submissionAttempts
211β
212```ts
213submissionAttempts: number;
214```
215β
216Defined in: [FormApi/FormApi.public.ts:533](https://github.com/TanStack/form/blob/main/packages/form-core/src/FormApi/FormApi.public.ts#L533)
217β
218Number of submission attempts started since the last reset.
219β
220An attempt is counted before validation begins, whether it succeeds or
221fails. `formApi.reset()` returns the count to `0`.
222β
223***
224β
225### values
226β
227```ts
228values: TFormData;
229```
230β
231Defined in: [FormApi/FormApi.public.ts:433](https://github.com/TanStack/form/blob/main/packages/form-core/src/FormApi/FormApi.public.ts#L433)
232β
233Current values after field edits, resets, or default-value updates.