Defined in: packages/form-core/src/FormApi.ts:880
A class representing the Form API. It handles the logic and interactions with the form state.
Normally, you will not need to create a new FormApi instance directly. Instead, you will use a framework hook/function like useForm or createForm 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 FormApi constructor.
TFormData
TOnMount extends undefined | FormValidateOrFn<TFormData>
TOnChange extends undefined | FormValidateOrFn<TFormData>
TOnChangeAsync extends undefined | FormAsyncValidateOrFn<TFormData>
TOnBlur extends undefined | FormValidateOrFn<TFormData>
TOnBlurAsync extends undefined | FormAsyncValidateOrFn<TFormData>
TOnSubmit extends undefined | FormValidateOrFn<TFormData>
TOnSubmitAsync extends undefined | FormAsyncValidateOrFn<TFormData>
TOnDynamic extends undefined | FormValidateOrFn<TFormData>
TOnDynamicAsync extends undefined | FormAsyncValidateOrFn<TFormData>
TOnServer extends undefined | FormAsyncValidateOrFn<TFormData>
TSubmitMeta = never
new FormApi<TFormData, TOnMount, TOnChange, TOnChangeAsync, TOnBlur, TOnBlurAsync, TOnSubmit, TOnSubmitAsync, TOnDynamic, TOnDynamicAsync, TOnServer, TSubmitMeta>(opts?): FormApi<TFormData, TOnMount, TOnChange, TOnChangeAsync, TOnBlur, TOnBlurAsync, TOnSubmit, TOnSubmitAsync, TOnDynamic, TOnDynamicAsync, TOnServer, TSubmitMeta>;
new FormApi<TFormData, TOnMount, TOnChange, TOnChangeAsync, TOnBlur, TOnBlurAsync, TOnSubmit, TOnSubmitAsync, TOnDynamic, TOnDynamicAsync, TOnServer, TSubmitMeta>(opts?): FormApi<TFormData, TOnMount, TOnChange, TOnChangeAsync, TOnBlur, TOnBlurAsync, TOnSubmit, TOnSubmitAsync, TOnDynamic, TOnDynamicAsync, TOnServer, TSubmitMeta>;
Defined in: packages/form-core/src/FormApi.ts:991
Constructs a new FormApi instance with the given form options.
FormOptions<TFormData, TOnMount, TOnChange, TOnChangeAsync, TOnBlur, TOnBlurAsync, TOnSubmit, TOnSubmitAsync, TOnDynamic, TOnDynamicAsync, TOnServer, TSubmitMeta>
FormApi<TFormData, TOnMount, TOnChange, TOnChangeAsync, TOnBlur, TOnBlurAsync, TOnSubmit, TOnSubmitAsync, TOnDynamic, TOnDynamicAsync, TOnServer, TSubmitMeta>
baseStore: Store<BaseFormState<TFormData, TOnMount, TOnChange, TOnChangeAsync, TOnBlur, TOnBlurAsync, TOnSubmit, TOnSubmitAsync, TOnDynamic, TOnDynamicAsync, TOnServer>>;
baseStore: Store<BaseFormState<TFormData, TOnMount, TOnChange, TOnChangeAsync, TOnBlur, TOnBlurAsync, TOnSubmit, TOnSubmitAsync, TOnDynamic, TOnDynamicAsync, TOnServer>>;
Defined in: packages/form-core/src/FormApi.ts:912
fieldInfo: Record<DeepKeys<TFormData>, FieldInfo<TFormData>>;
fieldInfo: Record<DeepKeys<TFormData>, FieldInfo<TFormData>>;
Defined in: packages/form-core/src/FormApi.ts:960
A record of field information for each field in the form.
fieldMetaDerived: Derived<Partial<Record<DeepKeys<TFormData>, AnyFieldMeta>>>;
fieldMetaDerived: Derived<Partial<Record<DeepKeys<TFormData>, AnyFieldMeta>>>;
Defined in: packages/form-core/src/FormApi.ts:927
options: FormOptions<TFormData, TOnMount, TOnChange, TOnChangeAsync, TOnBlur, TOnBlurAsync, TOnSubmit, TOnSubmitAsync, TOnDynamic, TOnDynamicAsync, TOnServer, TSubmitMeta> = {};
options: FormOptions<TFormData, TOnMount, TOnChange, TOnChangeAsync, TOnBlur, TOnBlurAsync, TOnSubmit, TOnSubmitAsync, TOnDynamic, TOnDynamicAsync, TOnServer, TSubmitMeta> = {};
Defined in: packages/form-core/src/FormApi.ts:898
The options for the form.
store: Derived<FormState<TFormData, TOnMount, TOnChange, TOnChangeAsync, TOnBlur, TOnBlurAsync, TOnSubmit, TOnSubmitAsync, TOnDynamic, TOnDynamicAsync, TOnServer>>;
store: Derived<FormState<TFormData, TOnMount, TOnChange, TOnChangeAsync, TOnBlur, TOnBlurAsync, TOnSubmit, TOnSubmitAsync, TOnDynamic, TOnDynamicAsync, TOnServer>>;
Defined in: packages/form-core/src/FormApi.ts:942
get formId(): string;
get formId(): string;
Defined in: packages/form-core/src/FormApi.ts:1349
string
get state(): FormState<TFormData, TOnMount, TOnChange, TOnChangeAsync, TOnBlur, TOnBlurAsync, TOnSubmit, TOnSubmitAsync, TOnDynamic, TOnDynamicAsync, TOnServer>;
get state(): FormState<TFormData, TOnMount, TOnChange, TOnChangeAsync, TOnBlur, TOnBlurAsync, TOnSubmit, TOnSubmitAsync, TOnDynamic, TOnDynamicAsync, TOnServer>;
Defined in: packages/form-core/src/FormApi.ts:962
FormState<TFormData, TOnMount, TOnChange, TOnChangeAsync, TOnBlur, TOnBlurAsync, TOnSubmit, TOnSubmitAsync, TOnDynamic, TOnDynamicAsync, TOnServer>
clearFieldValues<TField>(field, options?): void;
clearFieldValues<TField>(field, options?): void;
Defined in: packages/form-core/src/FormApi.ts:2491
Clear all values within an array field.
TField extends string
TField
UpdateMetaOptions
void
FieldManipulator.clearFieldValues
FieldManipulator.clearFieldValues
deleteField<TField>(field): void;
deleteField<TField>(field): void;
Defined in: packages/form-core/src/FormApi.ts:2283
TField extends string
TField
void
FieldManipulator.deleteField
FieldManipulator.deleteField
getAllErrors(): object;
getAllErrors(): object;
Defined in: packages/form-core/src/FormApi.ts:2606
Returns form and field level errors
object
fields: Record<DeepKeys<TFormData>, {
errorMap: ValidationErrorMap;
errors: ValidationError[];
}>;
fields: Record<DeepKeys<TFormData>, {
errorMap: ValidationErrorMap;
errors: ValidationError[];
}>;
form: object;
form: object;
errorMap: ValidationErrorMap<UnwrapFormValidateOrFn<TOnMount>, UnwrapFormValidateOrFn<TOnChange>, UnwrapFormAsyncValidateOrFn<TOnChangeAsync>, UnwrapFormValidateOrFn<TOnBlur>, UnwrapFormAsyncValidateOrFn<TOnBlurAsync>, UnwrapFormValidateOrFn<TOnSubmit>, UnwrapFormAsyncValidateOrFn<TOnSubmitAsync>, UnwrapFormValidateOrFn<TOnDynamic>, UnwrapFormAsyncValidateOrFn<TOnDynamicAsync>, UnwrapFormAsyncValidateOrFn<TOnServer>>;
errorMap: ValidationErrorMap<UnwrapFormValidateOrFn<TOnMount>, UnwrapFormValidateOrFn<TOnChange>, UnwrapFormAsyncValidateOrFn<TOnChangeAsync>, UnwrapFormValidateOrFn<TOnBlur>, UnwrapFormAsyncValidateOrFn<TOnBlurAsync>, UnwrapFormValidateOrFn<TOnSubmit>, UnwrapFormAsyncValidateOrFn<TOnSubmitAsync>, UnwrapFormValidateOrFn<TOnDynamic>, UnwrapFormAsyncValidateOrFn<TOnDynamicAsync>, UnwrapFormAsyncValidateOrFn<TOnServer>>;
errors: (
| UnwrapFormValidateOrFn<TOnMount>
| UnwrapFormValidateOrFn<TOnChange>
| UnwrapFormAsyncValidateOrFn<TOnChangeAsync>
| UnwrapFormValidateOrFn<TOnBlur>
| UnwrapFormAsyncValidateOrFn<TOnBlurAsync>
| UnwrapFormValidateOrFn<TOnSubmit>
| UnwrapFormAsyncValidateOrFn<TOnSubmitAsync>
| UnwrapFormValidateOrFn<TOnDynamic>
| UnwrapFormAsyncValidateOrFn<TOnDynamicAsync>
| UnwrapFormAsyncValidateOrFn<TOnServer>)[];
errors: (
| UnwrapFormValidateOrFn<TOnMount>
| UnwrapFormValidateOrFn<TOnChange>
| UnwrapFormAsyncValidateOrFn<TOnChangeAsync>
| UnwrapFormValidateOrFn<TOnBlur>
| UnwrapFormAsyncValidateOrFn<TOnBlurAsync>
| UnwrapFormValidateOrFn<TOnSubmit>
| UnwrapFormAsyncValidateOrFn<TOnSubmitAsync>
| UnwrapFormValidateOrFn<TOnDynamic>
| UnwrapFormAsyncValidateOrFn<TOnDynamicAsync>
| UnwrapFormAsyncValidateOrFn<TOnServer>)[];
getFieldInfo<TField>(field): FieldInfo<TFormData>;
getFieldInfo<TField>(field): FieldInfo<TFormData>;
Defined in: packages/form-core/src/FormApi.ts:2186
Gets the field info of the specified field.
TField extends string
TField
FieldInfo<TFormData>
getFieldMeta<TField>(field): AnyFieldMeta | undefined;
getFieldMeta<TField>(field): AnyFieldMeta | undefined;
Defined in: packages/form-core/src/FormApi.ts:2177
Gets the metadata of the specified field.
TField extends string
TField
AnyFieldMeta | undefined
FieldManipulator.getFieldMeta
FieldManipulator.getFieldMeta
getFieldValue<TField>(field): DeepValue<TFormData, TField>;
getFieldValue<TField>(field): DeepValue<TFormData, TField>;
Defined in: packages/form-core/src/FormApi.ts:2170
Gets the value of the specified field.
TField extends string
TField
DeepValue<TFormData, TField>
FieldManipulator.getFieldValue
FieldManipulator.getFieldValue
handleSubmit(): Promise<void>;
handleSubmit(): Promise<void>;
Defined in: packages/form-core/src/FormApi.ts:2022
Handles the form submission, performs validation, and calls the appropriate onSubmit or onSubmitInvalid callbacks.
Promise<void>
FieldManipulator.handleSubmit
FieldManipulator.handleSubmit
handleSubmit(submitMeta): Promise<void>;
handleSubmit(submitMeta): Promise<void>;
Defined in: packages/form-core/src/FormApi.ts:2023
Handles the form submission, performs validation, and calls the appropriate onSubmit or onSubmitInvalid callbacks.
TSubmitMeta
Promise<void>
FieldManipulator.handleSubmit
FieldManipulator.handleSubmit
insertFieldValue<TField>(
field,
index,
value,
options?): Promise<void>;
insertFieldValue<TField>(
field,
index,
value,
options?): Promise<void>;
Defined in: packages/form-core/src/FormApi.ts:2321
TField extends string
TField
number
DeepValue<TFormData, TField> extends any[] ? any[] & DeepValue<TFormData, TField>[number] : never
UpdateMetaOptions
Promise<void>
FieldManipulator.insertFieldValue
FieldManipulator.insertFieldValue
mount(): () => void;
mount(): () => void;
Defined in: packages/form-core/src/FormApi.ts:1378
(): void;
(): void;
void
moveFieldValues<TField>(
field,
index1,
index2,
options?): void;
moveFieldValues<TField>(
field,
index1,
index2,
options?): void;
Defined in: packages/form-core/src/FormApi.ts:2459
Moves the value at the first specified index to the second specified index within an array field.
TField extends string
TField
number
number
UpdateMetaOptions
void
FieldManipulator.moveFieldValues
FieldManipulator.moveFieldValues
parseValuesWithSchema(schema):
| {
fields: Record<string, StandardSchemaV1Issue[]>;
form: Record<string, StandardSchemaV1Issue[]>;
}
| undefined;
parseValuesWithSchema(schema):
| {
fields: Record<string, StandardSchemaV1Issue[]>;
form: Record<string, StandardSchemaV1Issue[]>;
}
| undefined;
Defined in: packages/form-core/src/FormApi.ts:2670
Parses the form's values with a given standard schema and returns issues (if any). This method does NOT set any internal errors.
StandardSchemaV1<TFormData, unknown>
The standard schema to parse the form values with.
| { fields: Record<string, StandardSchemaV1Issue[]>; form: Record<string, StandardSchemaV1Issue[]>; } | undefined
parseValuesWithSchemaAsync(schema): Promise<
| {
fields: Record<string, StandardSchemaV1Issue[]>;
form: Record<string, StandardSchemaV1Issue[]>;
}
| undefined>;
parseValuesWithSchemaAsync(schema): Promise<
| {
fields: Record<string, StandardSchemaV1Issue[]>;
form: Record<string, StandardSchemaV1Issue[]>;
}
| undefined>;
Defined in: packages/form-core/src/FormApi.ts:2682
Parses the form's values with a given standard schema and returns issues (if any). This method does NOT set any internal errors.
StandardSchemaV1<TFormData, unknown>
The standard schema to parse the form values with.
Promise< | { fields: Record<string, StandardSchemaV1Issue[]>; form: Record<string, StandardSchemaV1Issue[]>; } | undefined>
pushFieldValue<TField>(
field,
value,
options?): void;
pushFieldValue<TField>(
field,
value,
options?): void;
Defined in: packages/form-core/src/FormApi.ts:2307
Pushes a value into an array field.
TField extends string
TField
DeepValue<TFormData, TField> extends any[] ? any[] & DeepValue<TFormData, TField>[number] : never
UpdateMetaOptions
void
FieldManipulator.pushFieldValue
FieldManipulator.pushFieldValue
removeFieldValue<TField>(
field,
index,
options?): Promise<void>;
removeFieldValue<TField>(
field,
index,
options?): Promise<void>;
Defined in: packages/form-core/src/FormApi.ts:2387
Removes a value from an array field at the specified index.
TField extends string
TField
number
UpdateMetaOptions
Promise<void>
FieldManipulator.removeFieldValue
FieldManipulator.removeFieldValue
replaceFieldValue<TField>(
field,
index,
value,
options?): Promise<void>;
replaceFieldValue<TField>(
field,
index,
value,
options?): Promise<void>;
Defined in: packages/form-core/src/FormApi.ts:2358
Replaces a value into an array field at the specified index.
TField extends string
TField
number
DeepValue<TFormData, TField> extends any[] ? any[] & DeepValue<TFormData, TField>[number] : never
UpdateMetaOptions
Promise<void>
FieldManipulator.replaceFieldValue
FieldManipulator.replaceFieldValue
reset(values?, opts?): void;
reset(values?, opts?): void;
Defined in: packages/form-core/src/FormApi.ts:1489
Resets the form state to the default values. If values are provided, the form will be reset to those values instead and the default values will be updated.
TFormData
Optional values to reset the form to.
Optional options to control the reset behavior.
boolean
void
resetField<TField>(field): void;
resetField<TField>(field): void;
Defined in: packages/form-core/src/FormApi.ts:2524
Resets the field value and meta to default state
TField extends string
TField
void
FieldManipulator.resetField
FieldManipulator.resetField
resetFieldMeta<TField>(fieldMeta): Partial<Record<TField, AnyFieldMeta>>;
resetFieldMeta<TField>(fieldMeta): Partial<Record<TField, AnyFieldMeta>>;
Defined in: packages/form-core/src/FormApi.ts:2227
resets every field's meta
TField extends string
Partial<Record<TField, AnyFieldMeta>>
Partial<Record<TField, AnyFieldMeta>>
setErrorMap(errorMap): void;
setErrorMap(errorMap): void;
Defined in: packages/form-core/src/FormApi.ts:2542
Updates the form's errorMap
FormValidationErrorMap<TFormData, UnwrapFormValidateOrFn<TOnMount>, UnwrapFormValidateOrFn<TOnChange>, UnwrapFormAsyncValidateOrFn<TOnChangeAsync>, UnwrapFormValidateOrFn<TOnBlur>, UnwrapFormAsyncValidateOrFn<TOnBlurAsync>, UnwrapFormValidateOrFn<TOnSubmit>, UnwrapFormAsyncValidateOrFn<TOnSubmitAsync>, UnwrapFormValidateOrFn<TOnDynamic>, UnwrapFormAsyncValidateOrFn<TOnDynamicAsync>, UnwrapFormAsyncValidateOrFn<TOnServer>>
void
setFieldMeta<TField>(field, updater): void;
setFieldMeta<TField>(field, updater): void;
Defined in: packages/form-core/src/FormApi.ts:2206
Updates the metadata of the specified field.
TField extends string
TField
void
FieldManipulator.setFieldMeta
FieldManipulator.setFieldMeta
setFieldValue<TField>(
field,
updater,
opts?): void;
setFieldValue<TField>(
field,
updater,
opts?): void;
Defined in: packages/form-core/src/FormApi.ts:2243
Sets the value of the specified field and optionally updates the touched state.
TField extends string
TField
Updater<DeepValue<TFormData, TField>>
UpdateMetaOptions
void
FieldManipulator.setFieldValue
FieldManipulator.setFieldValue
swapFieldValues<TField>(
field,
index1,
index2,
options?): void;
swapFieldValues<TField>(
field,
index1,
index2,
options?): void;
Defined in: packages/form-core/src/FormApi.ts:2427
Swaps the values at the specified indices within an array field.
TField extends string
TField
number
number
UpdateMetaOptions
void
FieldManipulator.swapFieldValues
FieldManipulator.swapFieldValues
update(options?): void;
update(options?): void;
Defined in: packages/form-core/src/FormApi.ts:1413
Updates the form options and form state.
FormOptions<TFormData, TOnMount, TOnChange, TOnChangeAsync, TOnBlur, TOnBlurAsync, TOnSubmit, TOnSubmitAsync, TOnDynamic, TOnDynamicAsync, TOnServer, TSubmitMeta>
void
validateAllFields(cause): Promise<unknown[]>;
validateAllFields(cause): Promise<unknown[]>;
Defined in: packages/form-core/src/FormApi.ts:1515
Validates all fields using the correct handlers for a given validation cause.
ValidationCause
Promise<unknown[]>
FieldManipulator.validateAllFields
FieldManipulator.validateAllFields
validateArrayFieldsStartingFrom<TField>(
field,
index,
cause): Promise<unknown[]>;
validateArrayFieldsStartingFrom<TField>(
field,
index,
cause): Promise<unknown[]>;
Defined in: packages/form-core/src/FormApi.ts:1545
Validates the children of a specified array in the form starting from a given index until the end using the correct handlers for a given validation type.
TField extends string
TField
number
ValidationCause
Promise<unknown[]>
FieldManipulator.validateArrayFieldsStartingFrom
FieldManipulator.validateArrayFieldsStartingFrom
validateField<TField>(field, cause): unknown[] | Promise<unknown[]>;
validateField<TField>(field, cause): unknown[] | Promise<unknown[]>;
Defined in: packages/form-core/src/FormApi.ts:1586
Validates a specified field in the form using the correct handlers for a given validation type.
TField extends string
TField
ValidationCause
unknown[] | Promise<unknown[]>
FieldManipulator.validateField
FieldManipulator.validateField
