TanStack
API Reference

FieldApi

Interface: FieldApi<TFieldName, TFieldValue, TFieldError, TFormData, TFormErrorTypes>

Defined in: FieldApi/FieldApi.public.ts:100

Type Parameters

TFieldName

TFieldName

TFieldValue

TFieldValue

TFieldError

TFieldError

TFormData

TFormData

TFormErrorTypes

TFormErrorTypes extends FormErrorTypes

Properties

atom

ts
atom: ReadonlyAtom<FieldState<TFieldValue, TFieldError>>;

Defined in: FieldApi/FieldApi.public.ts:174


clearValues

ts
clearValues: FieldClearValuesFn;

Defined in: FieldApi/FieldApi.public.ts:156

Clear all values from this field's array. If this field is not an array, this method will be ignored.

Param

options

Optional update options


errors

ts
errors: FieldErrors<TFieldError>;

Defined in: FieldApi/FieldApi.public.ts:180


filterValues

ts
filterValues: FieldFilterValuesFn<TFieldValue>;

Defined in: FieldApi/FieldApi.public.ts:172

Filter the values in this field's array using a predicate function. If this field is not an array, this method will be ignored.

Param

predicate

The predicate function to filter values. Returns true to keep the value, false to remove it.

Param

options

Optional update options including a custom thisArg for the predicate


form

ts
form: FormApi<TFormData, TFormErrorTypes>;

Defined in: FieldApi/FieldApi.public.ts:110

The form that owns this field.


handleBlur

ts
handleBlur: FieldVoidFn;

Defined in: FieldApi/FieldApi.public.ts:184


handleChange

ts
handleChange: FieldHandleChangeFn<TFieldValue>;

Defined in: FieldApi/FieldApi.public.ts:182


insertValue

ts
insertValue: FieldInsertValueFn<TFieldValue>;

Defined in: FieldApi/FieldApi.public.ts:149

Insert a new value into this field's array at the specified index. If this field is not an array, this method will be ignored.

Param

index

The index at which to insert the value

Param

value

The value to insert

Param

options

Optional update options


meta

ts
meta: FieldMeta<TFieldError>;

Defined in: FieldApi/FieldApi.public.ts:178


moveValue

ts
moveValue: FieldMoveValueFn;

Defined in: FieldApi/FieldApi.public.ts:132

Move an element in this field's array from one index to another. If this field is not an array, this method will be ignored.

Param

fromIndex

The current index of the element to move

Param

toIndex

The index to move the element to

Param

options

Optional update options


pushValue

ts
pushValue: FieldPushValueFn<TFieldValue>;

Defined in: FieldApi/FieldApi.public.ts:140

Push a new value into this field's array. If this field is not an array, this method will be ignored.

Param

value

The value to push into the array

Param

options

Optional update options


removeValue

ts
removeValue: FieldRemoveValueFn;

Defined in: FieldApi/FieldApi.public.ts:164

Remove a value from this field's array at the specified index. If this field is not an array, this method will be ignored.

Param

index

The index of the value to remove

Param

options

Optional update options


reset

ts
reset: FieldVoidFn;

Defined in: FieldApi/FieldApi.public.ts:186


swapValues

ts
swapValues: (indexA, indexB) => void;

Defined in: FieldApi/FieldApi.public.ts:123

Swap two elements in this field's array. If this field is not an array, this method will be ignored.

Parameters

indexA

number

The index of the first element to swap

indexB

number

The index of the second element to swap

Returns

void


value

ts
value: TFieldValue;

Defined in: FieldApi/FieldApi.public.ts:176

Accessors

name

Get Signature

ts
get name(): TFieldName;

Defined in: FieldApi/FieldApi.public.ts:115

The name of the field.

Returns

TFieldName