@@ -7,7 +7,7 @@ title: FieldApi
7
7
8
8
# Class: FieldApi\< TParentData, TName, TData, TOnMount, TOnChange, TOnChangeAsync, TOnBlur, TOnBlurAsync, TOnSubmit, TOnSubmitAsync, TFormOnMount, TFormOnChange, TFormOnChangeAsync, TFormOnBlur, TFormOnBlurAsync, TFormOnSubmit, TFormOnSubmitAsync, TFormOnServer\>
9
9
10
- Defined in: [ packages/form-core/src/FieldApi.ts:832 ] ( https://github.com/TanStack/form/blob/main/packages/form-core/src/FieldApi.ts#L832 )
10
+ Defined in: [ packages/form-core/src/FieldApi.ts:858 ] ( https://github.com/TanStack/form/blob/main/packages/form-core/src/FieldApi.ts#L858 )
11
11
12
12
A class representing the API for managing a form field.
13
13
@@ -63,7 +63,7 @@ the `new FieldApi` constructor.
63
63
new FieldApi <TParentData , TName , TData , TOnMount , TOnChange , TOnChangeAsync , TOnBlur , TOnBlurAsync , TOnSubmit , TOnSubmitAsync , TFormOnMount , TFormOnChange , TFormOnChangeAsync , TFormOnBlur , TFormOnBlurAsync , TFormOnSubmit , TFormOnSubmitAsync , TFormOnServer >(opts ): FieldApi < TParentData , TName , TData , TOnMount , TOnChange , TOnChangeAsync , TOnBlur , TOnBlurAsync , TOnSubmit , TOnSubmitAsync , TFormOnMount , TFormOnChange , TFormOnChangeAsync , TFormOnBlur , TFormOnBlurAsync , TFormOnSubmit , TFormOnSubmitAsync , TFormOnServer >
64
64
```
65
65
66
- Defined in: [ packages/form-core/src/FieldApi.ts:943 ] ( https://github.com/TanStack/form/blob/main/packages/form-core/src/FieldApi.ts#L943 )
66
+ Defined in: [ packages/form-core/src/FieldApi.ts:969 ] ( https://github.com/TanStack/form/blob/main/packages/form-core/src/FieldApi.ts#L969 )
67
67
68
68
Initializes a new ` FieldApi ` instance.
69
69
@@ -85,7 +85,7 @@ Initializes a new `FieldApi` instance.
85
85
form : FormApi < TParentData , TFormOnMount , TFormOnChange , TFormOnChangeAsync , TFormOnBlur , TFormOnBlurAsync , TFormOnSubmit , TFormOnSubmitAsync , TFormOnServer > ;
86
86
```
87
87
88
- Defined in: [ packages/form-core/src/FieldApi.ts:861 ] ( https://github.com/TanStack/form/blob/main/packages/form-core/src/FieldApi.ts#L861 )
88
+ Defined in: [ packages/form-core/src/FieldApi.ts:887 ] ( https://github.com/TanStack/form/blob/main/packages/form-core/src/FieldApi.ts#L887 )
89
89
90
90
A reference to the form API instance.
91
91
@@ -97,7 +97,7 @@ A reference to the form API instance.
97
97
name : unknown extends TParentData ? string : TParentData extends readonly any [] & IsTuple < TParentData > ? PrefixTupleAccessor < TParentData < TParentData > , AllowedIndexes < TParentData < TParentData > , never > , []> : TParentData extends any [] ? PrefixArrayAccessor < TParentData < TParentData > , [any ]> : TParentData extends Date ? never : TParentData extends object ? PrefixObjectAccessor < TParentData < TParentData > , []> : TParentData extends string | number | bigint | boolean ? " " : never ;
98
98
```
99
99
100
- Defined in: [ packages/form-core/src/FieldApi.ts:884 ] ( https://github.com/TanStack/form/blob/main/packages/form-core/src/FieldApi.ts#L884 )
100
+ Defined in: [ packages/form-core/src/FieldApi.ts:910 ] ( https://github.com/TanStack/form/blob/main/packages/form-core/src/FieldApi.ts#L910 )
101
101
102
102
The field name.
103
103
@@ -109,7 +109,7 @@ The field name.
109
109
options : FieldApiOptions < TParentData , TName , TData , TOnMount , TOnChange , TOnChangeAsync , TOnBlur , TOnBlurAsync , TOnSubmit , TOnSubmitAsync , TFormOnMount , TFormOnChange , TFormOnChangeAsync , TFormOnBlur , TFormOnBlurAsync , TFormOnSubmit , TFormOnSubmitAsync , TFormOnServer > ;
110
110
```
111
111
112
- Defined in: [ packages/form-core/src/FieldApi.ts:888 ] ( https://github.com/TanStack/form/blob/main/packages/form-core/src/FieldApi.ts#L888 )
112
+ Defined in: [ packages/form-core/src/FieldApi.ts:914 ] ( https://github.com/TanStack/form/blob/main/packages/form-core/src/FieldApi.ts#L914 )
113
113
114
114
The field options.
115
115
@@ -121,7 +121,7 @@ The field options.
121
121
store : Derived < FieldState < TParentData , TName , TData , TOnMount , TOnChange , TOnChangeAsync , TOnBlur , TOnBlurAsync , TOnSubmit , TOnSubmitAsync , TFormOnMount , TFormOnChange , TFormOnChangeAsync , TFormOnBlur , TFormOnBlurAsync , TFormOnSubmit , TFormOnSubmitAsync >> ;
122
122
```
123
123
124
- Defined in: [ packages/form-core/src/FieldApi.ts:911 ] ( https://github.com/TanStack/form/blob/main/packages/form-core/src/FieldApi.ts#L911 )
124
+ Defined in: [ packages/form-core/src/FieldApi.ts:937 ] ( https://github.com/TanStack/form/blob/main/packages/form-core/src/FieldApi.ts#L937 )
125
125
126
126
The field state store.
127
127
@@ -133,7 +133,7 @@ The field state store.
133
133
timeoutIds : Record < ValidationCause , null | Timeout > ;
134
134
```
135
135
136
- Defined in: [ packages/form-core/src/FieldApi.ts:938 ] ( https://github.com/TanStack/form/blob/main/packages/form-core/src/FieldApi.ts#L938 )
136
+ Defined in: [ packages/form-core/src/FieldApi.ts:964 ] ( https://github.com/TanStack/form/blob/main/packages/form-core/src/FieldApi.ts#L964 )
137
137
138
138
## Accessors
139
139
@@ -145,7 +145,7 @@ Defined in: [packages/form-core/src/FieldApi.ts:938](https://github.com/TanStack
145
145
get state (): FieldState < TParentData , TName , TData , TOnMount , TOnChange , TOnChangeAsync , TOnBlur , TOnBlurAsync , TOnSubmit , TOnSubmitAsync , TFormOnMount , TFormOnChange , TFormOnChangeAsync , TFormOnBlur , TFormOnBlurAsync , TFormOnSubmit , TFormOnSubmitAsync >
146
146
```
147
147
148
- Defined in: [ packages/form-core/src/FieldApi.ts:935 ] ( https://github.com/TanStack/form/blob/main/packages/form-core/src/FieldApi.ts#L935 )
148
+ Defined in: [ packages/form-core/src/FieldApi.ts:961 ] ( https://github.com/TanStack/form/blob/main/packages/form-core/src/FieldApi.ts#L961 )
149
149
150
150
The current field state.
151
151
@@ -161,7 +161,7 @@ The current field state.
161
161
getInfo (): FieldInfo < TParentData >
162
162
```
163
163
164
- Defined in: [ packages/form-core/src/FieldApi.ts:1189 ] ( https://github.com/TanStack/form/blob/main/packages/form-core/src/FieldApi.ts#L1189 )
164
+ Defined in: [ packages/form-core/src/FieldApi.ts:1215 ] ( https://github.com/TanStack/form/blob/main/packages/form-core/src/FieldApi.ts#L1215 )
165
165
166
166
Gets the field information object.
167
167
@@ -177,7 +177,7 @@ Gets the field information object.
177
177
getMeta (): FieldMeta < TParentData , TName , TData , TOnMount , TOnChange , TOnChangeAsync , TOnBlur , TOnBlurAsync , TOnSubmit , TOnSubmitAsync , TFormOnMount , TFormOnChange , TFormOnChangeAsync , TFormOnBlur , TFormOnBlurAsync , TFormOnSubmit , TFormOnSubmitAsync >
178
178
```
179
179
180
- Defined in: [ packages/form-core/src/FieldApi.ts:1157 ] ( https://github.com/TanStack/form/blob/main/packages/form-core/src/FieldApi.ts#L1157 )
180
+ Defined in: [ packages/form-core/src/FieldApi.ts:1183 ] ( https://github.com/TanStack/form/blob/main/packages/form-core/src/FieldApi.ts#L1183 )
181
181
182
182
#### Returns
183
183
@@ -191,7 +191,7 @@ Defined in: [packages/form-core/src/FieldApi.ts:1157](https://github.com/TanStac
191
191
getValue (): TData
192
192
```
193
193
194
- Defined in: [ packages/form-core/src/FieldApi.ts:1139 ] ( https://github.com/TanStack/form/blob/main/packages/form-core/src/FieldApi.ts#L1139 )
194
+ Defined in: [ packages/form-core/src/FieldApi.ts:1165 ] ( https://github.com/TanStack/form/blob/main/packages/form-core/src/FieldApi.ts#L1165 )
195
195
196
196
Gets the current field value.
197
197
@@ -211,7 +211,7 @@ Use `field.state.value` instead.
211
211
handleBlur (): void
212
212
```
213
213
214
- Defined in: [ packages/form-core/src/FieldApi.ts:1561 ] ( https://github.com/TanStack/form/blob/main/packages/form-core/src/FieldApi.ts#L1561 )
214
+ Defined in: [ packages/form-core/src/FieldApi.ts:1587 ] ( https://github.com/TanStack/form/blob/main/packages/form-core/src/FieldApi.ts#L1587 )
215
215
216
216
Handles the blur event.
217
217
@@ -227,7 +227,7 @@ Handles the blur event.
227
227
handleChange (updater ): void
228
228
```
229
229
230
- Defined in: [ packages/form-core/src/FieldApi.ts:1554 ] ( https://github.com/TanStack/form/blob/main/packages/form-core/src/FieldApi.ts#L1554 )
230
+ Defined in: [ packages/form-core/src/FieldApi.ts:1580 ] ( https://github.com/TanStack/form/blob/main/packages/form-core/src/FieldApi.ts#L1580 )
231
231
232
232
Handles the change event.
233
233
@@ -252,7 +252,7 @@ insertValue(
252
252
opts ? ): Promise < void >
253
253
` ` `
254
254
255
- Defined in: [packages/form-core/src/FieldApi.ts:1202 ](https://github.com/TanStack/form/blob/main/packages/form-core/src/FieldApi.ts#L1202 )
255
+ Defined in: [packages/form-core/src/FieldApi.ts:1228 ](https://github.com/TanStack/form/blob/main/packages/form-core/src/FieldApi.ts#L1228 )
256
256
257
257
Inserts a value at the specified index, shifting the subsequent values to the right.
258
258
@@ -282,7 +282,7 @@ Inserts a value at the specified index, shifting the subsequent values to the ri
282
282
mount (): () => void
283
283
` ` `
284
284
285
- Defined in: [packages/form-core/src/FieldApi.ts:1046 ](https://github.com/TanStack/form/blob/main/packages/form-core/src/FieldApi.ts#L1046 )
285
+ Defined in: [packages/form-core/src/FieldApi.ts:1072 ](https://github.com/TanStack/form/blob/main/packages/form-core/src/FieldApi.ts#L1072 )
286
286
287
287
Mounts the field instance to the form.
288
288
@@ -305,7 +305,7 @@ moveValue(
305
305
opts ? ): void
306
306
` ` `
307
307
308
- Defined in: [packages/form-core/src/FieldApi.ts:1232 ](https://github.com/TanStack/form/blob/main/packages/form-core/src/FieldApi.ts#L1232 )
308
+ Defined in: [packages/form-core/src/FieldApi.ts:1258 ](https://github.com/TanStack/form/blob/main/packages/form-core/src/FieldApi.ts#L1258 )
309
309
310
310
Moves the value at the first specified index to the second specified index.
311
311
@@ -335,7 +335,7 @@ Moves the value at the first specified index to the second specified index.
335
335
pushValue (value , opts ? ): void
336
336
` ` `
337
337
338
- Defined in: [packages/form-core/src/FieldApi.ts:1194 ](https://github.com/TanStack/form/blob/main/packages/form-core/src/FieldApi.ts#L1194 )
338
+ Defined in: [packages/form-core/src/FieldApi.ts:1220 ](https://github.com/TanStack/form/blob/main/packages/form-core/src/FieldApi.ts#L1220 )
339
339
340
340
Pushes a new value to the field.
341
341
@@ -361,7 +361,7 @@ Pushes a new value to the field.
361
361
removeValue (index , opts ? ): Promise < void >
362
362
` ` `
363
363
364
- Defined in: [packages/form-core/src/FieldApi.ts:1220 ](https://github.com/TanStack/form/blob/main/packages/form-core/src/FieldApi.ts#L1220 )
364
+ Defined in: [packages/form-core/src/FieldApi.ts:1246 ](https://github.com/TanStack/form/blob/main/packages/form-core/src/FieldApi.ts#L1246 )
365
365
366
366
Removes a value at the specified index.
367
367
@@ -390,7 +390,7 @@ replaceValue(
390
390
opts ? ): Promise < void >
391
391
` ` `
392
392
393
- Defined in: [packages/form-core/src/FieldApi.ts:1211 ](https://github.com/TanStack/form/blob/main/packages/form-core/src/FieldApi.ts#L1211 )
393
+ Defined in: [packages/form-core/src/FieldApi.ts:1237 ](https://github.com/TanStack/form/blob/main/packages/form-core/src/FieldApi.ts#L1237 )
394
394
395
395
Replaces a value at the specified index.
396
396
@@ -420,7 +420,7 @@ Replaces a value at the specified index.
420
420
setErrorMap (errorMap ): void
421
421
` ` `
422
422
423
- Defined in: [packages/form-core/src/FieldApi.ts:1581 ](https://github.com/TanStack/form/blob/main/packages/form-core/src/FieldApi.ts#L1581 )
423
+ Defined in: [packages/form-core/src/FieldApi.ts:1607 ](https://github.com/TanStack/form/blob/main/packages/form-core/src/FieldApi.ts#L1607 )
424
424
425
425
Updates the field's errorMap
426
426
@@ -442,7 +442,7 @@ Updates the field's errorMap
442
442
setMeta (updater ): void
443
443
` ` `
444
444
445
- Defined in: [packages/form-core/src/FieldApi.ts:1162 ](https://github.com/TanStack/form/blob/main/packages/form-core/src/FieldApi.ts#L1162 )
445
+ Defined in: [packages/form-core/src/FieldApi.ts:1188 ](https://github.com/TanStack/form/blob/main/packages/form-core/src/FieldApi.ts#L1188 )
446
446
447
447
Sets the field metadata.
448
448
@@ -464,7 +464,7 @@ Sets the field metadata.
464
464
setValue (updater , options ? ): void
465
465
` ` `
466
466
467
- Defined in: [packages/form-core/src/FieldApi.ts:1146 ](https://github.com/TanStack/form/blob/main/packages/form-core/src/FieldApi.ts#L1146 )
467
+ Defined in: [packages/form-core/src/FieldApi.ts:1172 ](https://github.com/TanStack/form/blob/main/packages/form-core/src/FieldApi.ts#L1172 )
468
468
469
469
Sets the field value and run the ` change ` validator.
470
470
@@ -493,7 +493,7 @@ swapValues(
493
493
opts ? ): void
494
494
` ` `
495
495
496
- Defined in: [packages/form-core/src/FieldApi.ts:1226 ](https://github.com/TanStack/form/blob/main/packages/form-core/src/FieldApi.ts#L1226 )
496
+ Defined in: [packages/form-core/src/FieldApi.ts:1252 ](https://github.com/TanStack/form/blob/main/packages/form-core/src/FieldApi.ts#L1252 )
497
497
498
498
Swaps the values at the specified indices.
499
499
@@ -523,7 +523,7 @@ Swaps the values at the specified indices.
523
523
update (opts ): void
524
524
` ` `
525
525
526
- Defined in: [packages/form-core/src/FieldApi.ts:1088 ](https://github.com/TanStack/form/blob/main/packages/form-core/src/FieldApi.ts#L1088 )
526
+ Defined in: [packages/form-core/src/FieldApi.ts:1114 ](https://github.com/TanStack/form/blob/main/packages/form-core/src/FieldApi.ts#L1114 )
527
527
528
528
Updates the field instance with new options.
529
529
@@ -545,7 +545,7 @@ Updates the field instance with new options.
545
545
validate (cause , opts ? ): unknown [] | Promise < unknown []>
546
546
` ` `
547
547
548
- Defined in: [packages/form-core/src/FieldApi.ts:1521 ](https://github.com/TanStack/form/blob/main/packages/form-core/src/FieldApi.ts#L1521 )
548
+ Defined in: [packages/form-core/src/FieldApi.ts:1547 ](https://github.com/TanStack/form/blob/main/packages/form-core/src/FieldApi.ts#L1547 )
549
549
550
550
Validates the field value.
551
551
0 commit comments