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

fieldoptions.md

136 lines3.2 KB

1---
2id: FieldOptions
3title: FieldOptions
4---
5​
6# Interface: FieldOptions\<TParentData, TName, TFieldValidator, TFormValidator, TData\>
7​
8An object type representing the options for a field in a form.
9​
10## Extended by
11​
12- [`FieldApiOptions`](fieldapioptions.md)
13​
14## Type Parameters
15​
16β€’ **TParentData**
17​
18β€’ **TName** *extends* [`DeepKeys`](../type-aliases/deepkeys.md)\<`TParentData`\>
19​
20β€’ **TFieldValidator** *extends* `Validator`\<[`DeepValue`](../type-aliases/deepvalue.md)\<`TParentData`, `TName`\>, `unknown`\> \| `undefined` = `undefined`
21​
22β€’ **TFormValidator** *extends* `Validator`\<`TParentData`, `unknown`\> \| `undefined` = `undefined`
23​
24β€’ **TData** *extends* [`DeepValue`](../type-aliases/deepvalue.md)\<`TParentData`, `TName`\> = [`DeepValue`](../type-aliases/deepvalue.md)\<`TParentData`, `TName`\>
25​
26## Properties
27​
28### asyncAlways?
29​
30```ts
31optional asyncAlways: boolean;
32```
33​
34If `true`, always run async validation, even if there are errors emitted during synchronous validation.
35​
36#### Defined in
37​
38[packages/form-core/src/FieldApi.ts:311](https://github.com/TanStack/form/blob/main/packages/form-core/src/FieldApi.ts#L311)
39​
40***
41​
42### asyncDebounceMs?
43​
44```ts
45optional asyncDebounceMs: number;
46```
47​
48The default time to debounce async validation if there is not a more specific debounce time passed.
49​
50#### Defined in
51​
52[packages/form-core/src/FieldApi.ts:307](https://github.com/TanStack/form/blob/main/packages/form-core/src/FieldApi.ts#L307)
53​
54***
55​
56### defaultMeta?
57​
58```ts
59optional defaultMeta: Partial<FieldMeta>;
60```
61​
62An optional object with default metadata for the field.
63​
64#### Defined in
65​
66[packages/form-core/src/FieldApi.ts:329](https://github.com/TanStack/form/blob/main/packages/form-core/src/FieldApi.ts#L329)
67​
68***
69​
70### defaultValue?
71​
72```ts
73optional defaultValue: NoInfer<TData>;
74```
75​
76An optional default value for the field.
77​
78#### Defined in
79​
80[packages/form-core/src/FieldApi.ts:303](https://github.com/TanStack/form/blob/main/packages/form-core/src/FieldApi.ts#L303)
81​
82***
83​
84### listeners?
85​
86```ts
87optional listeners: FieldListeners<TParentData, TName, TFieldValidator, TFormValidator, TData>;
88```
89​
90A list of listeners which attach to the corresponding events
91​
92#### Defined in
93​
94[packages/form-core/src/FieldApi.ts:333](https://github.com/TanStack/form/blob/main/packages/form-core/src/FieldApi.ts#L333)
95​
96***
97​
98### name
99​
100```ts
101name: TName;
102```
103​
104The field name. The type will be `DeepKeys<TParentData>` to ensure your name is a deep key of the parent dataset.
105​
106#### Defined in
107​
108[packages/form-core/src/FieldApi.ts:299](https://github.com/TanStack/form/blob/main/packages/form-core/src/FieldApi.ts#L299)
109​
110***
111​
112### validatorAdapter?
113​
114```ts
115optional validatorAdapter: TFieldValidator;
116```
117​
118A validator provided by an extension, like `yupValidator` from `@tanstack/yup-form-adapter`
119​
120#### Defined in
121​
122[packages/form-core/src/FieldApi.ts:315](https://github.com/TanStack/form/blob/main/packages/form-core/src/FieldApi.ts#L315)
123​
124***
125​
126### validators?
127​
128```ts
129optional validators: FieldValidators<TParentData, TName, TFieldValidator, TFormValidator, TData>;
130```
131​
132A list of validators to pass to the field
133​
134#### Defined in
135​
136[packages/form-core/src/FieldApi.ts:319](https://github.com/TanStack/form/blob/main/packages/form-core/src/FieldApi.ts#L319)