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

fieldoptions.md

122 lines2.9 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:287](https://github.com/TanStack/form/blob/main/packages/form-core/src/FieldApi.ts#L287)
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:283](https://github.com/TanStack/form/blob/main/packages/form-core/src/FieldApi.ts#L283)
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:305](https://github.com/TanStack/form/blob/main/packages/form-core/src/FieldApi.ts#L305)
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:279](https://github.com/TanStack/form/blob/main/packages/form-core/src/FieldApi.ts#L279)
81​
82***
83​
84### name
85​
86```ts
87name: TName;
88```
89​
90The field name. The type will be `DeepKeys<TParentData>` to ensure your name is a deep key of the parent dataset.
91​
92#### Defined in
93​
94[packages/form-core/src/FieldApi.ts:275](https://github.com/TanStack/form/blob/main/packages/form-core/src/FieldApi.ts#L275)
95​
96***
97​
98### validatorAdapter?
99​
100```ts
101optional validatorAdapter: TFieldValidator;
102```
103​
104A validator provided by an extension, like `yupValidator` from `@tanstack/yup-form-adapter`
105​
106#### Defined in
107​
108[packages/form-core/src/FieldApi.ts:291](https://github.com/TanStack/form/blob/main/packages/form-core/src/FieldApi.ts#L291)
109​
110***
111​
112### validators?
113​
114```ts
115optional validators: FieldValidators<TParentData, TName, TFieldValidator, TFormValidator, TData>;
116```
117​
118A list of validators to pass to the field
119​
120#### Defined in
121​
122[packages/form-core/src/FieldApi.ts:295](https://github.com/TanStack/form/blob/main/packages/form-core/src/FieldApi.ts#L295)