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

FormState.md

166 lines2.6 KB

Type Alias: FormState<TFormData>

type FormState<TFormData>: object;

An object representing the current state of the form.

Type Parameters

• TFormData

Type declaration

canSubmit

canSubmit: boolean;

A boolean indicating if the form can be submitted based on its current state.

errorMap

errorMap: ValidationErrorMap;

The error map for the form itself.

errors

errors: ValidationError[];

The error array for the form itself.

fieldMeta

fieldMeta: Record<DeepKeys<TFormData>, FieldMeta>;

A record of field metadata for each field in the form.

isDirty

isDirty: boolean;

A boolean indicating if any of the form's fields' values have been modified by the user. True if the user have modified at least one of the fields. Opposite of isPristine.

isFieldsValid

isFieldsValid: boolean;

A boolean indicating if all the form fields are valid.

isFieldsValidating

isFieldsValidating: boolean;

A boolean indicating if any of the form fields are currently validating.

isFormValid

isFormValid: boolean;

A boolean indicating if the form is valid.

isFormValidating

isFormValidating: boolean;

A boolean indicating if the form is currently validating.

isPristine

isPristine: boolean;

A boolean indicating if none of the form's fields' values have been modified by the user. True if the user have not modified any of the fields. Opposite of isDirty.

isSubmitted

isSubmitted: boolean;

A boolean indicating if the form has been submitted.

isSubmitting

isSubmitting: boolean;

A boolean indicating if the form is currently submitting.

isTouched

isTouched: boolean;

A boolean indicating if any of the form fields have been touched.

isValid

isValid: boolean;

A boolean indicating if the form and all its fields are valid.

isValidating

isValidating: boolean;

A boolean indicating if the form or any of its fields are currently validating.

submissionAttempts

submissionAttempts: number;

A counter for tracking the number of submission attempts.

validationMetaMap

validationMetaMap: Record<ValidationErrorMapKeys, ValidationMeta | undefined>;

An internal mechanism used for keeping track of validation logic in a form.

values

values: TFormData;

The current values of the form fields.

Defined in

packages/form-core/src/FormApi.ts:198