FormOptions

Interface: FormOptions<TFormData, TOnMount, TOnChange, TOnChangeAsync, TOnBlur, TOnBlurAsync, TOnSubmit, TOnSubmitAsync, TOnServer, TSubmitMeta>

Defined in: packages/form-core/src/FormApi.ts:238

An object representing the options for a form.

Type Parameters

TFormData

TOnMount extends undefined | FormValidateOrFn<TFormData>

TOnChange extends undefined | FormValidateOrFn<TFormData>

TOnChangeAsync extends undefined | FormAsyncValidateOrFn<TFormData>

TOnBlur extends undefined | FormValidateOrFn<TFormData>

TOnBlurAsync extends undefined | FormAsyncValidateOrFn<TFormData>

TOnSubmit extends undefined | FormValidateOrFn<TFormData>

TOnSubmitAsync extends undefined | FormAsyncValidateOrFn<TFormData>

TOnServer extends undefined | FormAsyncValidateOrFn<TFormData>

TSubmitMeta = never

Properties

asyncAlways?

ts
optional asyncAlways: boolean;
optional asyncAlways: boolean;

Defined in: packages/form-core/src/FormApi.ts:273

If true, always run async validation, even when sync validation has produced an error. Defaults to undefined.


asyncDebounceMs?

ts
optional asyncDebounceMs: number;
optional asyncDebounceMs: number;

Defined in: packages/form-core/src/FormApi.ts:277

Optional time in milliseconds if you want to introduce a delay before firing off an async action.


canSubmitWhenInvalid?

ts
optional canSubmitWhenInvalid: boolean;
optional canSubmitWhenInvalid: boolean;

Defined in: packages/form-core/src/FormApi.ts:281

If true, allows the form to be submitted in an invalid state i.e. canSubmit will remain true regardless of validation errors. Defaults to undefined.


defaultState?

ts
optional defaultState: Partial<FormState<TFormData, TOnMount, TOnChange, TOnChangeAsync, TOnBlur, TOnBlurAsync, TOnSubmit, TOnSubmitAsync, TOnServer>>;
optional defaultState: Partial<FormState<TFormData, TOnMount, TOnChange, TOnChangeAsync, TOnBlur, TOnBlurAsync, TOnSubmit, TOnSubmitAsync, TOnServer>>;

Defined in: packages/form-core/src/FormApi.ts:257

The default state for the form.


defaultValues?

ts
optional defaultValues: TFormData;
optional defaultValues: TFormData;

Defined in: packages/form-core/src/FormApi.ts:253

Set initial values for your form.


onSubmit()?

ts
optional onSubmit: (props) => any;
optional onSubmit: (props) => any;

Defined in: packages/form-core/src/FormApi.ts:304

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>

Parameters

props
formApi

FormApi<TFormData, TOnMount, TOnChange, TOnChangeAsync, TOnBlur, TOnBlurAsync, TOnSubmit, TOnSubmitAsync, TOnServer, TSubmitMeta>

meta

TSubmitMeta

value

TFormData

Returns

any


onSubmitInvalid()?

ts
optional onSubmitInvalid: (props) => void;
optional onSubmitInvalid: (props) => void;

Defined in: packages/form-core/src/FormApi.ts:323

Specify an action for scenarios where the user tries to submit an invalid form.

Parameters

props
formApi

FormApi<TFormData, TOnMount, TOnChange, TOnChangeAsync, TOnBlur, TOnBlurAsync, TOnSubmit, TOnSubmitAsync, TOnServer, TSubmitMeta>

value

TFormData

Returns

void


onSubmitMeta?

ts
optional onSubmitMeta: TSubmitMeta;
optional onSubmitMeta: TSubmitMeta;

Defined in: packages/form-core/src/FormApi.ts:299

onSubmitMeta, the data passed from the handleSubmit handler, to the onSubmit function props


transform?

ts
optional transform: FormTransform<NoInfer<TFormData>, NoInfer<TOnMount>, NoInfer<TOnChange>, NoInfer<TOnChangeAsync>, NoInfer<TOnBlur>, NoInfer<TOnBlurAsync>, NoInfer<TOnSubmit>, NoInfer<TOnSubmitAsync>, NoInfer<TOnServer>, NoInfer<TSubmitMeta>>;
optional transform: FormTransform<NoInfer<TFormData>, NoInfer<TOnMount>, NoInfer<TOnChange>, NoInfer<TOnChangeAsync>, NoInfer<TOnBlur>, NoInfer<TOnBlurAsync>, NoInfer<TOnSubmit>, NoInfer<TOnSubmitAsync>, NoInfer<TOnServer>, NoInfer<TSubmitMeta>>;

Defined in: packages/form-core/src/FormApi.ts:338


validators?

ts
optional validators: FormValidators<TFormData, TOnMount, TOnChange, TOnChangeAsync, TOnBlur, TOnBlurAsync, TOnSubmit, TOnSubmitAsync>;
optional validators: FormValidators<TFormData, TOnMount, TOnChange, TOnChangeAsync, TOnBlur, TOnBlurAsync, TOnSubmit, TOnSubmitAsync>;

Defined in: packages/form-core/src/FormApi.ts:285

A list of validators to pass to the form