Defined in: packages/form-core/src/FieldApi.ts:974
A class representing the API for managing a form field.
Normally, you will not need to create a new FieldApi instance directly. Instead, you will use a framework hook/function like useField or createField to create a new instance for you that uses your framework's reactivity model. However, if you need to create a new instance manually, you can do so by calling the new FieldApi constructor.
TParentData
TName extends DeepKeys<TParentData>
TData extends DeepValue<TParentData, TName>
TOnMount extends undefined | FieldValidateOrFn<TParentData, TName, TData>
TOnChange extends undefined | FieldValidateOrFn<TParentData, TName, TData>
TOnChangeAsync extends undefined | FieldAsyncValidateOrFn<TParentData, TName, TData>
TOnBlur extends undefined | FieldValidateOrFn<TParentData, TName, TData>
TOnBlurAsync extends undefined | FieldAsyncValidateOrFn<TParentData, TName, TData>
TOnSubmit extends undefined | FieldValidateOrFn<TParentData, TName, TData>
TOnSubmitAsync extends undefined | FieldAsyncValidateOrFn<TParentData, TName, TData>
TOnDynamic extends undefined | FieldValidateOrFn<TParentData, TName, TData>
TOnDynamicAsync extends undefined | FieldAsyncValidateOrFn<TParentData, TName, TData>
TFormOnMount extends undefined | FormValidateOrFn<TParentData>
TFormOnChange extends undefined | FormValidateOrFn<TParentData>
TFormOnChangeAsync extends undefined | FormAsyncValidateOrFn<TParentData>
TFormOnBlur extends undefined | FormValidateOrFn<TParentData>
TFormOnBlurAsync extends undefined | FormAsyncValidateOrFn<TParentData>
TFormOnSubmit extends undefined | FormValidateOrFn<TParentData>
TFormOnSubmitAsync extends undefined | FormAsyncValidateOrFn<TParentData>
TFormOnDynamic extends undefined | FormValidateOrFn<TParentData>
TFormOnDynamicAsync extends undefined | FormAsyncValidateOrFn<TParentData>
TFormOnServer extends undefined | FormAsyncValidateOrFn<TParentData>
TParentSubmitMeta
new FieldApi<TParentData, TName, TData, TOnMount, TOnChange, TOnChangeAsync, TOnBlur, TOnBlurAsync, TOnSubmit, TOnSubmitAsync, TOnDynamic, TOnDynamicAsync, TFormOnMount, TFormOnChange, TFormOnChangeAsync, TFormOnBlur, TFormOnBlurAsync, TFormOnSubmit, TFormOnSubmitAsync, TFormOnDynamic, TFormOnDynamicAsync, TFormOnServer, TParentSubmitMeta>(opts): FieldApi<TParentData, TName, TData, TOnMount, TOnChange, TOnChangeAsync, TOnBlur, TOnBlurAsync, TOnSubmit, TOnSubmitAsync, TOnDynamic, TOnDynamicAsync, TFormOnMount, TFormOnChange, TFormOnChangeAsync, TFormOnBlur, TFormOnBlurAsync, TFormOnSubmit, TFormOnSubmitAsync, TFormOnDynamic, TFormOnDynamicAsync, TFormOnServer, TParentSubmitMeta>;
new FieldApi<TParentData, TName, TData, TOnMount, TOnChange, TOnChangeAsync, TOnBlur, TOnBlurAsync, TOnSubmit, TOnSubmitAsync, TOnDynamic, TOnDynamicAsync, TFormOnMount, TFormOnChange, TFormOnChangeAsync, TFormOnBlur, TFormOnBlurAsync, TFormOnSubmit, TFormOnSubmitAsync, TFormOnDynamic, TFormOnDynamicAsync, TFormOnServer, TParentSubmitMeta>(opts): FieldApi<TParentData, TName, TData, TOnMount, TOnChange, TOnChangeAsync, TOnBlur, TOnBlurAsync, TOnSubmit, TOnSubmitAsync, TOnDynamic, TOnDynamicAsync, TFormOnMount, TFormOnChange, TFormOnChangeAsync, TFormOnBlur, TFormOnBlurAsync, TFormOnSubmit, TFormOnSubmitAsync, TFormOnDynamic, TFormOnDynamicAsync, TFormOnServer, TParentSubmitMeta>;
Defined in: packages/form-core/src/FieldApi.ts:1128
Initializes a new FieldApi instance.
FieldApiOptions<TParentData, TName, TData, TOnMount, TOnChange, TOnChangeAsync, TOnBlur, TOnBlurAsync, TOnSubmit, TOnSubmitAsync, TOnDynamic, TOnDynamicAsync, TFormOnMount, TFormOnChange, TFormOnChangeAsync, TFormOnBlur, TFormOnBlurAsync, TFormOnSubmit, TFormOnSubmitAsync, TFormOnDynamic, TFormOnDynamicAsync, TFormOnServer, TParentSubmitMeta>
FieldApi<TParentData, TName, TData, TOnMount, TOnChange, TOnChangeAsync, TOnBlur, TOnBlurAsync, TOnSubmit, TOnSubmitAsync, TOnDynamic, TOnDynamicAsync, TFormOnMount, TFormOnChange, TFormOnChangeAsync, TFormOnBlur, TFormOnBlurAsync, TFormOnSubmit, TFormOnSubmitAsync, TFormOnDynamic, TFormOnDynamicAsync, TFormOnServer, TParentSubmitMeta>
form: FormApi<TParentData, TFormOnMount, TFormOnChange, TFormOnChangeAsync, TFormOnBlur, TFormOnBlurAsync, TFormOnSubmit, TFormOnSubmitAsync, TFormOnDynamic, TFormOnDynamicAsync, TFormOnServer, TParentSubmitMeta>;
form: FormApi<TParentData, TFormOnMount, TFormOnChange, TFormOnChangeAsync, TFormOnBlur, TFormOnBlurAsync, TFormOnSubmit, TFormOnSubmitAsync, TFormOnDynamic, TFormOnDynamicAsync, TFormOnServer, TParentSubmitMeta>;
Defined in: packages/form-core/src/FieldApi.ts:1028
A reference to the form API instance.
name: TName;
name: TName;
Defined in: packages/form-core/src/FieldApi.ts:1056
The field name.
options: FieldApiOptions<TParentData, TName, TData, TOnMount, TOnChange, TOnChangeAsync, TOnBlur, TOnBlurAsync, TOnSubmit, TOnSubmitAsync, TOnDynamic, TOnDynamicAsync, TFormOnMount, TFormOnChange, TFormOnChangeAsync, TFormOnBlur, TFormOnBlurAsync, TFormOnSubmit, TFormOnSubmitAsync, TFormOnDynamic, TFormOnDynamicAsync, TFormOnServer, TParentSubmitMeta>;
options: FieldApiOptions<TParentData, TName, TData, TOnMount, TOnChange, TOnChangeAsync, TOnBlur, TOnBlurAsync, TOnSubmit, TOnSubmitAsync, TOnDynamic, TOnDynamicAsync, TFormOnMount, TFormOnChange, TFormOnChangeAsync, TFormOnBlur, TFormOnBlurAsync, TFormOnSubmit, TFormOnSubmitAsync, TFormOnDynamic, TFormOnDynamicAsync, TFormOnServer, TParentSubmitMeta>;
Defined in: packages/form-core/src/FieldApi.ts:1060
The field options.
store: Derived<FieldState<TParentData, TName, TData, TOnMount, TOnChange, TOnChangeAsync, TOnBlur, TOnBlurAsync, TOnSubmit, TOnSubmitAsync, TOnDynamic, TOnDynamicAsync, TFormOnMount, TFormOnChange, TFormOnChangeAsync, TFormOnBlur, TFormOnBlurAsync, TFormOnSubmit, TFormOnSubmitAsync, TFormOnDynamic, TFormOnDynamicAsync>>;
store: Derived<FieldState<TParentData, TName, TData, TOnMount, TOnChange, TOnChangeAsync, TOnBlur, TOnBlurAsync, TOnSubmit, TOnSubmitAsync, TOnDynamic, TOnDynamicAsync, TFormOnMount, TFormOnChange, TFormOnChangeAsync, TFormOnBlur, TFormOnBlurAsync, TFormOnSubmit, TFormOnSubmitAsync, TFormOnDynamic, TFormOnDynamicAsync>>;
Defined in: packages/form-core/src/FieldApi.ts:1088
The field state store.
timeoutIds: object;
timeoutIds: object;
Defined in: packages/form-core/src/FieldApi.ts:1119
formListeners: Record<ListenerCause, ReturnType<typeof setTimeout> | null>;
formListeners: Record<ListenerCause, ReturnType<typeof setTimeout> | null>;
listeners: Record<ListenerCause, ReturnType<typeof setTimeout> | null>;
listeners: Record<ListenerCause, ReturnType<typeof setTimeout> | null>;
validations: Record<ValidationCause, ReturnType<typeof setTimeout> | null>;
validations: Record<ValidationCause, ReturnType<typeof setTimeout> | null>;
get state(): FieldState<TParentData, TName, TData, TOnMount, TOnChange, TOnChangeAsync, TOnBlur, TOnBlurAsync, TOnSubmit, TOnSubmitAsync, TOnDynamic, TOnDynamicAsync, TFormOnMount, TFormOnChange, TFormOnChangeAsync, TFormOnBlur, TFormOnBlurAsync, TFormOnSubmit, TFormOnSubmitAsync, TFormOnDynamic, TFormOnDynamicAsync>;
get state(): FieldState<TParentData, TName, TData, TOnMount, TOnChange, TOnChangeAsync, TOnBlur, TOnBlurAsync, TOnSubmit, TOnSubmitAsync, TOnDynamic, TOnDynamicAsync, TFormOnMount, TFormOnChange, TFormOnChangeAsync, TFormOnBlur, TFormOnBlurAsync, TFormOnSubmit, TFormOnSubmitAsync, TFormOnDynamic, TFormOnDynamicAsync>;
Defined in: packages/form-core/src/FieldApi.ts:1116
The current field state.
FieldState<TParentData, TName, TData, TOnMount, TOnChange, TOnChangeAsync, TOnBlur, TOnBlurAsync, TOnSubmit, TOnSubmitAsync, TOnDynamic, TOnDynamicAsync, TFormOnMount, TFormOnChange, TFormOnChangeAsync, TFormOnBlur, TFormOnBlurAsync, TFormOnSubmit, TFormOnSubmitAsync, TFormOnDynamic, TFormOnDynamicAsync>
clearValues(options?): void;
clearValues(options?): void;
Defined in: packages/form-core/src/FieldApi.ts:1519
Clear all values from the array.
UpdateMetaOptions
void
getInfo(): FieldInfo<TParentData>;
getInfo(): FieldInfo<TParentData>;
Defined in: packages/form-core/src/FieldApi.ts:1405
Gets the field information object.
FieldInfo<TParentData>
getMeta(): FieldMeta<TParentData, TName, TData, TOnMount, TOnChange, TOnChangeAsync, TOnBlur, TOnBlurAsync, TOnSubmit, TOnSubmitAsync, TOnDynamic, TOnDynamicAsync, TFormOnMount, TFormOnChange, TFormOnChangeAsync, TFormOnBlur, TFormOnBlurAsync, TFormOnSubmit, TFormOnSubmitAsync, TFormOnDynamic, TFormOnDynamicAsync>;
getMeta(): FieldMeta<TParentData, TName, TData, TOnMount, TOnChange, TOnChangeAsync, TOnBlur, TOnBlurAsync, TOnSubmit, TOnSubmitAsync, TOnDynamic, TOnDynamicAsync, TFormOnMount, TFormOnChange, TFormOnChangeAsync, TFormOnBlur, TFormOnBlurAsync, TFormOnSubmit, TFormOnSubmitAsync, TFormOnDynamic, TFormOnDynamicAsync>;
Defined in: packages/form-core/src/FieldApi.ts:1369
FieldMeta<TParentData, TName, TData, TOnMount, TOnChange, TOnChangeAsync, TOnBlur, TOnBlurAsync, TOnSubmit, TOnSubmitAsync, TOnDynamic, TOnDynamicAsync, TFormOnMount, TFormOnChange, TFormOnChangeAsync, TFormOnBlur, TFormOnBlurAsync, TFormOnSubmit, TFormOnSubmitAsync, TFormOnDynamic, TFormOnDynamicAsync>
getValue(): TData;
getValue(): TData;
Defined in: packages/form-core/src/FieldApi.ts:1346
Gets the current field value.
TData
Use field.state.value instead.
handleBlur(): void;
handleBlur(): void;
Defined in: packages/form-core/src/FieldApi.ts:1895
Handles the blur event.
void
handleChange(updater): void;
handleChange(updater): void;
Defined in: packages/form-core/src/FieldApi.ts:1888
Handles the change event.
Updater<TData>
void
insertValue(
index,
value,
options?): void;
insertValue(
index,
value,
options?): void;
Defined in: packages/form-core/src/FieldApi.ts:1428
Inserts a value at the specified index, shifting the subsequent values to the right.
number
TData extends any[] ? TData<TData>[number] : never
UpdateMetaOptions
void
mount(): () => void;
mount(): () => void;
Defined in: packages/form-core/src/FieldApi.ts:1242
Mounts the field instance to the form.
(): void;
(): void;
void
moveValue(
aIndex,
bIndex,
options?): void;
moveValue(
aIndex,
bIndex,
options?): void;
Defined in: packages/form-core/src/FieldApi.ts:1503
Moves the value at the first specified index to the second specified index.
number
number
UpdateMetaOptions
void
parseValueWithSchema(schema):
| StandardSchemaV1Issue[]
| undefined;
parseValueWithSchema(schema):
| StandardSchemaV1Issue[]
| undefined;
Defined in: packages/form-core/src/FieldApi.ts:1938
Parses the field's value with the given schema and returns issues (if any). This method does NOT set any internal errors.
StandardSchemaV1<TData, unknown>
The standard schema to parse this field's value with.
| StandardSchemaV1Issue[] | undefined
parseValueWithSchemaAsync(schema): Promise<
| StandardSchemaV1Issue[]
| undefined>;
parseValueWithSchemaAsync(schema): Promise<
| StandardSchemaV1Issue[]
| undefined>;
Defined in: packages/form-core/src/FieldApi.ts:1950
Parses the field's value with the given schema and returns issues (if any). This method does NOT set any internal errors.
StandardSchemaV1<TData, unknown>
The standard schema to parse this field's value with.
Promise< | StandardSchemaV1Issue[] | undefined>
pushValue(value, options?): void;
pushValue(value, options?): void;
Defined in: packages/form-core/src/FieldApi.ts:1410
Pushes a new value to the field.
TData extends any[] ? TData<TData>[number] : never
UpdateMetaOptions
void
removeValue(index, options?): void;
removeValue(index, options?): void;
Defined in: packages/form-core/src/FieldApi.ts:1468
Removes a value at the specified index.
number
UpdateMetaOptions
void
replaceValue(
index,
value,
options?): void;
replaceValue(
index,
value,
options?): void;
Defined in: packages/form-core/src/FieldApi.ts:1448
Replaces a value at the specified index.
number
TData extends any[] ? TData<TData>[number] : never
UpdateMetaOptions
void
setErrorMap(errorMap): void;
setErrorMap(errorMap): void;
Defined in: packages/form-core/src/FieldApi.ts:1911
Updates the field's errorMap
ValidationErrorMap<UnwrapFieldValidateOrFn<TName, TOnMount, TFormOnMount>, UnwrapFieldValidateOrFn<TName, TOnChange, TFormOnChange>, UnwrapFieldAsyncValidateOrFn<TName, TOnChangeAsync, TFormOnChangeAsync>, UnwrapFieldValidateOrFn<TName, TOnBlur, TFormOnBlur>, UnwrapFieldAsyncValidateOrFn<TName, TOnBlurAsync, TFormOnBlurAsync>, UnwrapFieldValidateOrFn<TName, TOnSubmit, TFormOnSubmit>, UnwrapFieldAsyncValidateOrFn<TName, TOnSubmitAsync, TFormOnSubmitAsync>, UnwrapFieldValidateOrFn<TName, TOnDynamic, TFormOnDynamic>, UnwrapFieldAsyncValidateOrFn<TName, TOnDynamicAsync, TFormOnDynamicAsync>>
void
setMeta(updater): void;
setMeta(updater): void;
Defined in: packages/form-core/src/FieldApi.ts:1374
Sets the field metadata.
Updater<FieldMetaBase<TParentData, TName, TData, TOnMount, TOnChange, TOnChangeAsync, TOnBlur, TOnBlurAsync, TOnSubmit, TOnSubmitAsync, TOnDynamic, TOnDynamicAsync, TFormOnMount, TFormOnChange, TFormOnChangeAsync, TFormOnBlur, TFormOnBlurAsync, TFormOnSubmit, TFormOnSubmitAsync, TFormOnDynamic, TFormOnDynamicAsync>>
void
setValue(updater, options?): void;
setValue(updater, options?): void;
Defined in: packages/form-core/src/FieldApi.ts:1353
Sets the field value and run the change validator.
Updater<TData>
UpdateMetaOptions
void
swapValues(
aIndex,
bIndex,
options?): void;
swapValues(
aIndex,
bIndex,
options?): void;
Defined in: packages/form-core/src/FieldApi.ts:1483
Swaps the values at the specified indices.
number
number
UpdateMetaOptions
void
update(opts): void;
update(opts): void;
Defined in: packages/form-core/src/FieldApi.ts:1295
Updates the field instance with new options.
FieldApiOptions<TParentData, TName, TData, TOnMount, TOnChange, TOnChangeAsync, TOnBlur, TOnBlurAsync, TOnSubmit, TOnSubmitAsync, TOnDynamic, TOnDynamicAsync, TFormOnMount, TFormOnChange, TFormOnChangeAsync, TFormOnBlur, TFormOnBlurAsync, TFormOnSubmit, TFormOnSubmitAsync, TFormOnDynamic, TFormOnDynamicAsync, TFormOnServer, TParentSubmitMeta>
void
validate(cause, opts?): unknown[] | Promise<unknown[]>;
validate(cause, opts?): unknown[] | Promise<unknown[]>;
Defined in: packages/form-core/src/FieldApi.ts:1855
Validates the field value.
ValidationCause
boolean
unknown[] | Promise<unknown[]>
