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

FieldApi.md

315 lines5.6 KB

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

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:191


clearValues

clearValues: FieldClearValuesFn;

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

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:197


filterValues

filterValues: FieldFilterValuesFn<TFieldValue>;

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

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:127

The form that owns this field.


handleBlur

handleBlur: FieldVoidFn;

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


handleChange

handleChange: FieldHandleChangeFn<TFieldValue>;

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


insertValue

insertValue: FieldInsertValueFn<TFieldValue>;

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

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:195


moveValue

moveValue: FieldMoveValueFn;

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

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:157

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:181

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

reset: FieldVoidFn;

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


swapValues

swapValues: (indexA, indexB) => void;

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

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:193

Accessors

name

Get Signature

get name(): TFieldName;

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

The name of the field.

Returns

TFieldName