An object representing the options for a form.
• TFormData
• TFormValidator extends Validator<TFormData, unknown> | undefined = undefined
optional asyncAlways: boolean;
optional asyncAlways: boolean;
If true, always run async validation, even when sync validation has produced an error. Defaults to undefined.
packages/form-core/src/FormApi.ts:152
optional asyncDebounceMs: number;
optional asyncDebounceMs: number;
Optional time in milliseconds if you want to introduce a delay before firing off an async action.
packages/form-core/src/FormApi.ts:156
optional defaultState: Partial<FormState<TFormData>>;
optional defaultState: Partial<FormState<TFormData>>;
The default state for the form.
packages/form-core/src/FormApi.ts:148
optional defaultValues: TFormData;
optional defaultValues: TFormData;
Set initial values for your form.
packages/form-core/src/FormApi.ts:144
optional onSubmit: (props) => any;
optional onSubmit: (props) => any;
A function to be called when the form is submitted, what should happen once the user submits a valid form returns any or a promise Promise<any>
• props
• props.formApi: FormApi<TFormData, TFormValidator>
• props.value: TFormData
any
packages/form-core/src/FormApi.ts:168
optional onSubmitInvalid: (props) => void;
optional onSubmitInvalid: (props) => void;
Specify an action for scenarios where the user tries to submit an invalid form.
• props
• props.formApi: FormApi<TFormData, TFormValidator>
• props.value: TFormData
void
packages/form-core/src/FormApi.ts:175
optional transform: FormTransform<TFormData, TFormValidator>;
optional transform: FormTransform<TFormData, TFormValidator>;
packages/form-core/src/FormApi.ts:179
optional validatorAdapter: TFormValidator;
optional validatorAdapter: TFormValidator;
A validator adapter to support usage of extra validation types (IE: Zod, Yup, or Valibot usage)
packages/form-core/src/FormApi.ts:160
optional validators: FormValidators<TFormData, TFormValidator>;
optional validators: FormValidators<TFormData, TFormValidator>;
A list of validators to pass to the form
Your weekly dose of JavaScript news. Delivered every Monday to over 100,000 devs, for free.