FormState

Type Alias: FormState<TFormData>

ts
type FormState<TFormData>: object;
type FormState<TFormData>: object;

An object representing the current state of the form.

Type Parameters

TFormData

Type declaration

canSubmit

ts
canSubmit: boolean;
canSubmit: boolean;

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

errorMap

ts
errorMap: ValidationErrorMap;
errorMap: ValidationErrorMap;

The error map for the form itself.

errors

ts
errors: ValidationError[];
errors: ValidationError[];

The error array for the form itself.

fieldMeta

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

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

isBlurred

ts
isBlurred: boolean;
isBlurred: boolean;

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

isDirty

ts
isDirty: boolean;
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

ts
isFieldsValid: boolean;
isFieldsValid: boolean;

A boolean indicating if all the form fields are valid.

isFieldsValidating

ts
isFieldsValidating: boolean;
isFieldsValidating: boolean;

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

isFormValid

ts
isFormValid: boolean;
isFormValid: boolean;

A boolean indicating if the form is valid.

isFormValidating

ts
isFormValidating: boolean;
isFormValidating: boolean;

A boolean indicating if the form is currently validating.

isPristine

ts
isPristine: boolean;
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

ts
isSubmitted: boolean;
isSubmitted: boolean;

A boolean indicating if the form has been submitted.

isSubmitting

ts
isSubmitting: boolean;
isSubmitting: boolean;

A boolean indicating if the form is currently submitting.

isTouched

ts
isTouched: boolean;
isTouched: boolean;

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

isValid

ts
isValid: boolean;
isValid: boolean;

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

isValidating

ts
isValidating: boolean;
isValidating: boolean;

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

submissionAttempts

ts
submissionAttempts: number;
submissionAttempts: number;

A counter for tracking the number of submission attempts.

validationMetaMap

ts
validationMetaMap: Record<ValidationErrorMapKeys, ValidationMeta | undefined>;
validationMetaMap: Record<ValidationErrorMapKeys, ValidationMeta | undefined>;

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

values

ts
values: TFormData;
values: TFormData;

The current values of the form fields.

Defined in

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

Subscribe to Bytes

Your weekly dose of JavaScript news. Delivered every Monday to over 100,000 devs, for free.

Bytes

No spam. Unsubscribe at any time.