Open History to see the last commit
1---
2id: TanStackField
3title: TanStackField
4---
5β
6# Class: TanStackField\<TParentData, TName, TFieldValidator, TFormValidator, TData\>
7β
8## Type Parameters
9β
10β’ **TParentData**
11β
12β’ **TName** *extends* `DeepKeys`\<`TParentData`\>
13β
14β’ **TFieldValidator** *extends* `Validator`\<`DeepValue`\<`TParentData`, `TName`\>, `unknown`\> \| `undefined` = `undefined`
15β
16β’ **TFormValidator** *extends* `Validator`\<`TParentData`, `unknown`\> \| `undefined` = `undefined`
17β
18β’ **TData** *extends* `DeepValue`\<`TParentData`, `TName`\> = `DeepValue`\<`TParentData`, `TName`\>
19β
20## Implements
21β
22- `OnInit`
23- `OnChanges`
24- `OnDestroy`
25- `FieldOptions`\<`TParentData`, `TName`, `TFieldValidator`, `TFormValidator`, `TData`\>
26β
27## Constructors
28β
29### new TanStackField()
30β
31```ts
32new TanStackField<TParentData, TName, TFieldValidator, TFormValidator, TData>(): TanStackField<TParentData, TName, TFieldValidator, TFormValidator, TData>
33```
34β
35#### Returns
36β
37[`TanStackField`](TanStackField.md)\<`TParentData`, `TName`, `TFieldValidator`, `TFormValidator`, `TData`\>
38β
39## Properties
40β
41### api
42β
43```ts
44api: FieldApi<TParentData, TName, TFieldValidator, TFormValidator, TData>;
45```
46β
47#### Defined in
48β
49[tanstack-field.directive.ts:61](https://github.com/TanStack/form/blob/a6313b7699753752ae30ff16c169e0b08c2369e8/packages/angular-form/src/tanstack-field.directive.ts#L61)
50β
51***
52β
53### asyncAlways?
54β
55```ts
56optional asyncAlways: boolean;
57```
58β
59If `true`, always run async validation, even if there are errors emitted during synchronous validation.
60β
61#### Implementation of
62β
63`FieldOptions.asyncAlways`
64β
65#### Defined in
66β
67[tanstack-field.directive.ts:50](https://github.com/TanStack/form/blob/a6313b7699753752ae30ff16c169e0b08c2369e8/packages/angular-form/src/tanstack-field.directive.ts#L50)
68β
69***
70β
71### asyncDebounceMs?
72β
73```ts
74optional asyncDebounceMs: number;
75```
76β
77The default time to debounce async validation if there is not a more specific debounce time passed.
78β
79#### Implementation of
80β
81`FieldOptions.asyncDebounceMs`
82β
83#### Defined in
84β
85[tanstack-field.directive.ts:49](https://github.com/TanStack/form/blob/a6313b7699753752ae30ff16c169e0b08c2369e8/packages/angular-form/src/tanstack-field.directive.ts#L49)
86β
87***
88β
89### defaultMeta?
90β
91```ts
92optional defaultMeta: Partial<FieldMeta>;
93```
94β
95An optional object with default metadata for the field.
96β
97#### Implementation of
98β
99`FieldOptions.defaultMeta`
100β
101#### Defined in
102β
103[tanstack-field.directive.ts:59](https://github.com/TanStack/form/blob/a6313b7699753752ae30ff16c169e0b08c2369e8/packages/angular-form/src/tanstack-field.directive.ts#L59)
104β
105***
106β
107### defaultValue?
108β
109```ts
110optional defaultValue: NoInfer<TData>;
111```
112β
113An optional default value for the field.
114β
115#### Implementation of
116β
117`FieldOptions.defaultValue`
118β
119#### Defined in
120β
121[tanstack-field.directive.ts:48](https://github.com/TanStack/form/blob/a6313b7699753752ae30ff16c169e0b08c2369e8/packages/angular-form/src/tanstack-field.directive.ts#L48)
122β
123***
124β
125### name
126β
127```ts
128name: TName;
129```
130β
131The field name. The type will be `DeepKeys<TParentData>` to ensure your name is a deep key of the parent dataset.
132β
133#### Implementation of
134β
135`FieldOptions.name`
136β
137#### Defined in
138β
139[tanstack-field.directive.ts:44](https://github.com/TanStack/form/blob/a6313b7699753752ae30ff16c169e0b08c2369e8/packages/angular-form/src/tanstack-field.directive.ts#L44)
140β
141***
142β
143### tanstackField
144β
145```ts
146tanstackField: FormApi<TParentData, TFormValidator>;
147```
148β
149#### Defined in
150β
151[tanstack-field.directive.ts:52](https://github.com/TanStack/form/blob/a6313b7699753752ae30ff16c169e0b08c2369e8/packages/angular-form/src/tanstack-field.directive.ts#L52)
152β
153***
154β
155### unmount()?
156β
157```ts
158optional unmount: () => void;
159```
160β
161#### Returns
162β
163`void`
164β
165#### Defined in
166β
167[tanstack-field.directive.ts:76](https://github.com/TanStack/form/blob/a6313b7699753752ae30ff16c169e0b08c2369e8/packages/angular-form/src/tanstack-field.directive.ts#L76)
168β
169***
170β
171### validatorAdapter?
172β
173```ts
174optional validatorAdapter: TFieldValidator;
175```
176β
177A validator provided by an extension, like `yupValidator` from `@tanstack/yup-form-adapter`
178β
179#### Implementation of
180β
181`FieldOptions.validatorAdapter`
182β
183#### Defined in
184β
185[tanstack-field.directive.ts:51](https://github.com/TanStack/form/blob/a6313b7699753752ae30ff16c169e0b08c2369e8/packages/angular-form/src/tanstack-field.directive.ts#L51)
186β
187***
188β
189### validators?
190β
191```ts
192optional validators: NoInfer<FieldValidators<TParentData, TName, TFieldValidator, TFormValidator, TData>>;
193```
194β
195A list of validators to pass to the field
196β
197#### Implementation of
198β
199`FieldOptions.validators`
200β
201#### Defined in
202β
203[tanstack-field.directive.ts:56](https://github.com/TanStack/form/blob/a6313b7699753752ae30ff16c169e0b08c2369e8/packages/angular-form/src/tanstack-field.directive.ts#L56)
204β
205## Methods
206β
207### ngOnChanges()
208β
209```ts
210ngOnChanges(): void
211```
212β
213A callback method that is invoked immediately after the
214default change detector has checked data-bound properties
215if at least one has changed, and before the view and content
216children are checked.
217β
218#### Returns
219β
220`void`
221β
222#### Implementation of
223β
224`OnChanges.ngOnChanges`
225β
226#### Defined in
227β
228[tanstack-field.directive.ts:88](https://github.com/TanStack/form/blob/a6313b7699753752ae30ff16c169e0b08c2369e8/packages/angular-form/src/tanstack-field.directive.ts#L88)
229β
230***
231β
232### ngOnDestroy()
233β
234```ts
235ngOnDestroy(): void
236```
237β
238A callback method that performs custom clean-up, invoked immediately
239before a directive, pipe, or service instance is destroyed.
240β
241#### Returns
242β
243`void`
244β
245#### Implementation of
246β
247`OnDestroy.ngOnDestroy`
248β
249#### Defined in
250β
251[tanstack-field.directive.ts:84](https://github.com/TanStack/form/blob/a6313b7699753752ae30ff16c169e0b08c2369e8/packages/angular-form/src/tanstack-field.directive.ts#L84)
252β
253***
254β
255### ngOnInit()
256β
257```ts
258ngOnInit(): void
259```
260β
261A callback method that is invoked immediately after the
262default change detector has checked the directive's
263data-bound properties for the first time,
264and before any of the view or content children have been checked.
265It is invoked only once when the directive is instantiated.
266β
267#### Returns
268β
269`void`
270β
271#### Implementation of
272β
273`OnInit.ngOnInit`
274β
275#### Defined in
276β
277[tanstack-field.directive.ts:78](https://github.com/TanStack/form/blob/a6313b7699753752ae30ff16c169e0b08c2369e8/packages/angular-form/src/tanstack-field.directive.ts#L78)