Skip to content
Source
Sign inSign up
TanStack/form
Open History to see the last commit

fieldoptions.md

134 lines4.0 KB

Interface: FieldOptions<TParentData, TName, TData, TOnMount, TOnChange, TOnChangeAsync, TOnBlur, TOnBlurAsync, TOnSubmit, TOnSubmitAsync>

Defined in: packages/form-core/src/FieldApi.ts:361

An object type representing the options for a field in a form.

Extended by

Type Parameters

• TParentData

• TName extends DeepKeys<TParentData>

• TData extends DeepValue<TParentData, TName>

• TOnMount extends undefined | FieldValidateOrFn<TParentData, TName, TData>

• TOnChange extends undefined | FieldValidateOrFn<TParentData, TName, TData>

• TOnChangeAsync extends undefined | FieldAsyncValidateOrFn<TParentData, TName, TData>

• TOnBlur extends undefined | FieldValidateOrFn<TParentData, TName, TData>

• TOnBlurAsync extends undefined | FieldAsyncValidateOrFn<TParentData, TName, TData>

• TOnSubmit extends undefined | FieldValidateOrFn<TParentData, TName, TData>

• TOnSubmitAsync extends undefined | FieldAsyncValidateOrFn<TParentData, TName, TData>

Properties

asyncAlways?

optional asyncAlways: boolean;

Defined in: packages/form-core/src/FieldApi.ts:394

If true, always run async validation, even if there are errors emitted during synchronous validation.


asyncDebounceMs?

optional asyncDebounceMs: number;

Defined in: packages/form-core/src/FieldApi.ts:390

The default time to debounce async validation if there is not a more specific debounce time passed.


defaultMeta?

optional defaultMeta: Partial<FieldMeta<TParentData, TName, TData, TOnMount, TOnChange, TOnChangeAsync, TOnBlur, TOnBlurAsync, TOnSubmit, TOnSubmitAsync, any, any, any, any, any, any, any>>;

Defined in: packages/form-core/src/FieldApi.ts:413

An optional object with default metadata for the field.


defaultValue?

optional defaultValue: NoInfer<TData>;

Defined in: packages/form-core/src/FieldApi.ts:386

An optional default value for the field.


disableErrorFlat?

optional disableErrorFlat: boolean;

Defined in: packages/form-core/src/FieldApi.ts:441

Disable the flat(1) operation on field.errors. This is useful if you want to keep the error structure as is. Not suggested for most use-cases.


listeners?

optional listeners: FieldListeners<TParentData, TName, TData>;

Defined in: packages/form-core/src/FieldApi.ts:437

A list of listeners which attach to the corresponding events


name

name: TName;

Defined in: packages/form-core/src/FieldApi.ts:382

The field name. The type will be DeepKeys<TParentData> to ensure your name is a deep key of the parent dataset.


validators?

optional validators: FieldValidators<TParentData, TName, TData, TOnMount, TOnChange, TOnChangeAsync, TOnBlur, TOnBlurAsync, TOnSubmit, TOnSubmitAsync>;

Defined in: packages/form-core/src/FieldApi.ts:398

A list of validators to pass to the field