Skip to content
Source
Sign inSign up
TanStack/form
Open History to see the last commit

fieldapioptions.md

194 lines6.1 KB

1---
2id: FieldApiOptions
3title: FieldApiOptions
4---
5​
6<!-- DO NOT EDIT: this page is autogenerated from the type comments -->
7​
8# Interface: FieldApiOptions\<TParentData, TName, TData, TOnMount, TOnChange, TOnChangeAsync, TOnBlur, TOnBlurAsync, TOnSubmit, TOnSubmitAsync, TFormOnMount, TFormOnChange, TFormOnChangeAsync, TFormOnBlur, TFormOnBlurAsync, TFormOnSubmit, TFormOnSubmitAsync, TFormOnServer, TParentSubmitMeta\>
9​
10Defined in: [packages/form-core/src/FieldApi.ts:448](https://github.com/TanStack/form/blob/main/packages/form-core/src/FieldApi.ts#L448)
11​
12An object type representing the required options for the FieldApi class.
13​
14## Extends
15​
16- [`FieldOptions`](fieldoptions.md)\<`TParentData`, `TName`, `TData`, `TOnMount`, `TOnChange`, `TOnChangeAsync`, `TOnBlur`, `TOnBlurAsync`, `TOnSubmit`, `TOnSubmitAsync`\>
17​
18## Type Parameters
19​
20• **TParentData**
21​
22• **TName** *extends* [`DeepKeys`](../type-aliases/deepkeys.md)\<`TParentData`\>
23​
24• **TData** *extends* [`DeepValue`](../type-aliases/deepvalue.md)\<`TParentData`, `TName`\>
25​
26• **TOnMount** *extends* `undefined` \| `FieldValidateOrFn`\<`TParentData`, `TName`, `TData`\>
27​
28• **TOnChange** *extends* `undefined` \| `FieldValidateOrFn`\<`TParentData`, `TName`, `TData`\>
29​
30• **TOnChangeAsync** *extends* `undefined` \| `FieldAsyncValidateOrFn`\<`TParentData`, `TName`, `TData`\>
31​
32• **TOnBlur** *extends* `undefined` \| `FieldValidateOrFn`\<`TParentData`, `TName`, `TData`\>
33​
34• **TOnBlurAsync** *extends* `undefined` \| `FieldAsyncValidateOrFn`\<`TParentData`, `TName`, `TData`\>
35​
36• **TOnSubmit** *extends* `undefined` \| `FieldValidateOrFn`\<`TParentData`, `TName`, `TData`\>
37​
38• **TOnSubmitAsync** *extends* `undefined` \| `FieldAsyncValidateOrFn`\<`TParentData`, `TName`, `TData`\>
39​
40• **TFormOnMount** *extends* `undefined` \| `FormValidateOrFn`\<`TParentData`\>
41​
42• **TFormOnChange** *extends* `undefined` \| `FormValidateOrFn`\<`TParentData`\>
43​
44• **TFormOnChangeAsync** *extends* `undefined` \| `FormAsyncValidateOrFn`\<`TParentData`\>
45​
46• **TFormOnBlur** *extends* `undefined` \| `FormValidateOrFn`\<`TParentData`\>
47​
48• **TFormOnBlurAsync** *extends* `undefined` \| `FormAsyncValidateOrFn`\<`TParentData`\>
49​
50• **TFormOnSubmit** *extends* `undefined` \| `FormValidateOrFn`\<`TParentData`\>
51​
52• **TFormOnSubmitAsync** *extends* `undefined` \| `FormAsyncValidateOrFn`\<`TParentData`\>
53​
54• **TFormOnServer** *extends* `undefined` \| `FormAsyncValidateOrFn`\<`TParentData`\>
55​
56• **TParentSubmitMeta**
57​
58## Properties
59​
60### asyncAlways?
61​
62```ts
63optional asyncAlways: boolean;
64```
65​
66Defined in: [packages/form-core/src/FieldApi.ts:395](https://github.com/TanStack/form/blob/main/packages/form-core/src/FieldApi.ts#L395)
67​
68If `true`, always run async validation, even if there are errors emitted during synchronous validation.
69​
70#### Inherited from
71​
72[`FieldOptions`](fieldoptions.md).[`asyncAlways`](FieldOptions.md#asyncalways)
73​
74***
75​
76### asyncDebounceMs?
77​
78```ts
79optional asyncDebounceMs: number;
80```
81​
82Defined in: [packages/form-core/src/FieldApi.ts:391](https://github.com/TanStack/form/blob/main/packages/form-core/src/FieldApi.ts#L391)
83​
84The default time to debounce async validation if there is not a more specific debounce time passed.
85​
86#### Inherited from
87​
88[`FieldOptions`](fieldoptions.md).[`asyncDebounceMs`](FieldOptions.md#asyncdebouncems)
89​
90***
91​
92### defaultMeta?
93​
94```ts
95optional defaultMeta: Partial<FieldMeta<TParentData, TName, TData, TOnMount, TOnChange, TOnChangeAsync, TOnBlur, TOnBlurAsync, TOnSubmit, TOnSubmitAsync, any, any, any, any, any, any, any>>;
96```
97​
98Defined in: [packages/form-core/src/FieldApi.ts:414](https://github.com/TanStack/form/blob/main/packages/form-core/src/FieldApi.ts#L414)
99​
100An optional object with default metadata for the field.
101​
102#### Inherited from
103​
104[`FieldOptions`](fieldoptions.md).[`defaultMeta`](FieldOptions.md#defaultmeta)
105​
106***
107​
108### defaultValue?
109​
110```ts
111optional defaultValue: NoInfer<TData>;
112```
113​
114Defined in: [packages/form-core/src/FieldApi.ts:387](https://github.com/TanStack/form/blob/main/packages/form-core/src/FieldApi.ts#L387)
115​
116An optional default value for the field.
117​
118#### Inherited from
119​
120[`FieldOptions`](fieldoptions.md).[`defaultValue`](FieldOptions.md#defaultvalue)
121​
122***
123​
124### disableErrorFlat?
125​
126```ts
127optional disableErrorFlat: boolean;
128```
129​
130Defined in: [packages/form-core/src/FieldApi.ts:442](https://github.com/TanStack/form/blob/main/packages/form-core/src/FieldApi.ts#L442)
131​
132Disable the `flat(1)` operation on `field.errors`. This is useful if you want to keep the error structure as is. Not suggested for most use-cases.
133​
134#### Inherited from
135​
136[`FieldOptions`](fieldoptions.md).[`disableErrorFlat`](FieldOptions.md#disableerrorflat)
137​
138***
139​
140### form
141​
142```ts
143form: FormApi<TParentData, TFormOnMount, TFormOnChange, TFormOnChangeAsync, TFormOnBlur, TFormOnBlurAsync, TFormOnSubmit, TFormOnSubmitAsync, TFormOnServer, TParentSubmitMeta>;
144```
145​
146Defined in: [packages/form-core/src/FieldApi.ts:486](https://github.com/TanStack/form/blob/main/packages/form-core/src/FieldApi.ts#L486)
147​
148***
149​
150### listeners?
151​
152```ts
153optional listeners: FieldListeners<TParentData, TName, TData>;
154```
155​
156Defined in: [packages/form-core/src/FieldApi.ts:438](https://github.com/TanStack/form/blob/main/packages/form-core/src/FieldApi.ts#L438)
157​
158A list of listeners which attach to the corresponding events
159​
160#### Inherited from
161​
162[`FieldOptions`](fieldoptions.md).[`listeners`](FieldOptions.md#listeners)
163​
164***
165​
166### name
167​
168```ts
169name: TName;
170```
171​
172Defined in: [packages/form-core/src/FieldApi.ts:383](https://github.com/TanStack/form/blob/main/packages/form-core/src/FieldApi.ts#L383)
173​
174The field name. The type will be `DeepKeys<TParentData>` to ensure your name is a deep key of the parent dataset.
175​
176#### Inherited from
177​
178[`FieldOptions`](fieldoptions.md).[`name`](FieldOptions.md#name)
179​
180***
181​
182### validators?
183​
184```ts
185optional validators: FieldValidators<TParentData, TName, TData, TOnMount, TOnChange, TOnChangeAsync, TOnBlur, TOnBlurAsync, TOnSubmit, TOnSubmitAsync>;
186```
187​
188Defined in: [packages/form-core/src/FieldApi.ts:399](https://github.com/TanStack/form/blob/main/packages/form-core/src/FieldApi.ts#L399)
189​
190A list of validators to pass to the field
191​
192#### Inherited from
193​
194[`FieldOptions`](fieldoptions.md).[`validators`](FieldOptions.md#validators)