AutoForm
Automatically render forms based on a schema.
Props#
| Prop | Type | Default | Description |
|---|---|---|---|
onSubmitrequired | SubmitHandler<TFieldValues> | The submit handler. | |
| children | string | number | bigint | boolean | ReactElement<any, string | JSXElementConstructor<any>> | Iterable<ReactNode> | ReactPortal | Promise<...> | ((props: FormRenderContext<...>) => ReactNode) | The form children, can be a render prop or a ReactNode. | |
| context | TContext | ||
| criteriaMode | CriteriaMode | ||
| defaultValues | type ONLY_FOR_FORMAT =
| AsyncDefaultValues<TFieldValues>
| DefaultValues<TFieldValues> | ||
| delayError | number | ||
| disabled | boolean | ||
| errors | FieldErrors<TFieldValues> | ||
| fieldResolver | FieldResolver | The field resolver, used to resolve the fields from schemas. | |
| fields | DefaultFieldOverrides | Field overrides | |
| formRef | type ONLY_FOR_FORMAT =
| ((
instance: UseFormReturn<TFieldValues, TContext> | null,
) => void | (() => VoidOrUndefinedOnly))
| RefObject<UseFormReturn<TFieldValues, TContext>> | The Hook Form state ref. | |
| mode | "onChange" | "onBlur" | "onSubmit" | "all" | "onTouched" | ||
| onChange | WatchObserver<TFieldValues> | Triggers when any of the field change. | |
| onError | SubmitErrorHandler<TFieldValues> | Triggers when there are validation errors. | |
| progressive | boolean | ||
| resetOptions | Partial<{
keepDirtyValues: boolean
keepErrors: boolean
keepDirty: boolean
keepValues: boolean
keepDefaultValues: boolean
keepIsSubmitted: boolean
keepIsSubmitSuccessful: boolean
keepTouched: boolean
keepIsValidating: boolean
keepIsValid: boolean
keepSubmitCount: boolean
}> | ||
| resolver | Resolver<TFieldValues, TContext> | ||
| reValidateMode | "onChange" | "onBlur" | "onSubmit" | ||
| schema | NonNullable<TSchema> | The form schema. | |
| shouldFocusError | boolean | ||
| shouldUnregister | boolean | ||
| shouldUseNativeValidation | boolean | ||
| values | TFieldValues |
Was this helpful?