Skip to main content

FormPropsContext

const FormPropsContext: Context<
| Partial<{
context: any;
criteriaMode: CriteriaMode;
defaultValues: | AsyncDefaultValues<FieldValues>
| {
[key: string]: any;
};
delayError: number;
disabled: boolean;
errors: FieldErrors<FieldValues>;
formControl?: Omit<UseFormReturn<FieldValues, any, FieldValues>, "formState">;
mode: "onBlur" | "onChange" | "onSubmit" | "all" | "onTouched";
progressive: boolean;
resetOptions: | Partial<{
keepDefaultValues: boolean;
keepDirty: boolean;
keepDirtyValues: boolean;
keepErrors: boolean;
keepFieldsRef: boolean;
keepIsSubmitSuccessful: boolean;
keepIsSubmitted: boolean;
keepIsValid: boolean;
keepIsValidating: boolean;
keepSubmitCount: boolean;
keepTouched: boolean;
keepValues: boolean;
}>
| undefined;
resolver: Resolver<FieldValues, any, FieldValues>;
reValidateMode: "onBlur" | "onChange" | "onSubmit";
shouldFocusError: boolean;
shouldUnregister: boolean;
shouldUseNativeValidation: boolean;
validate: ValidateForm<FieldValues>;
values: TFieldValues;
}>
| undefined>;

Side-channel context for the useForm configuration that the parent <Form> was created with.

react-hook-form's FormProvider only forwards a fixed allow-list of UseFormReturn fields into its context (see node_modules/react-hook-form), so extra props such as mode cannot ride along on useFormContext(). This context exposes the original reactHookFormProps to descendants (e.g. FormSubmitButton) that need to read mode.