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

FieldApi.md

346 lines6.1 KB

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

Type Parameters

TFieldName

TFieldName

TFieldValue

TFieldValue

TFieldError

TFieldError

TFormData

TFormData

TFormErrorTypes

TFormErrorTypes extends FormErrorTypes

Properties

atom

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

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


clearValues

clearValues: FieldClearValuesFn;

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

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

errors: FieldErrors<TFieldError>;

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


filterValues

filterValues: FieldFilterValuesFn<TFieldValue>;

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

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

form: FormApi<TFormData, TFormErrorTypes>;

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

The form that owns this field.


handleBlur

handleBlur: FieldVoidFn;

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


handleChange

handleChange: FieldHandleChangeFn<TFieldValue>;

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


insertValue

insertValue: FieldInsertValueFn<TFieldValue>;

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

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

meta: FieldMeta<TFieldError>;

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


moveValue

moveValue: FieldMoveValueFn;

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

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

pushValue: FieldPushValueFn<TFieldValue>;

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

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

removeValue: FieldRemoveValueFn;

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

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


replaceValue

replaceValue: FieldReplaceValueFn<TFieldValue>;

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

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

Param

index

The index of the value to replace

Param

value

The new value

Param

options

Optional update options


reset

reset: FieldVoidFn;

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


swapValues

swapValues: (indexA, indexB) => void;

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

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

value: TFieldValue;

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

Accessors

name

Get Signature

get name(): TFieldName;

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

The name of the field.

Returns

TFieldName