TanStack
FormApi Reference

SetFieldValueFn

Type Alias: SetFieldValueFn<TFormData>

ts
type SetFieldValueFn<TFormData> = <TDeepKeys>(DeepKeys, value, options?) => void;

Defined in: FormApi/FormApiFieldMethods.types.public.ts:23

Updates the current value at a field path.

The next value may be supplied directly or calculated from the current value. By default, the update marks the field as touched and dirty, notifies change listeners, and runs change validation.

Type Parameters

TFormData

TFormData

Library-managed. Do not specify explicitly.

Type Parameters

TDeepKeys

TDeepKeys extends DeepKeys<TFormData>

Library-managed. Do not specify explicitly.

Parameters

DeepKeys

TDeepKeys

The field path to update.

value

Updater<DeepValue<TFormData, TDeepKeys>>

The next value or an updater that receives the current value.

options?

FieldUpdateOptions

Controls metadata updates and whether validation runs.

Returns

void

Example

ts
formApi.setFieldValue('profile.name', 'Ada')
formApi.setFieldValue('visitCount', (count) => count + 1)