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

TanStackField.md

277 lines6.1 KB

Class: TanStackField<TParentData, TName, TFieldValidator, TFormValidator, TData>

Type Parameters

• TParentData

• TName extends DeepKeys<TParentData>

• TFieldValidator extends Validator<DeepValue<TParentData, TName>, unknown> | undefined = undefined

• TFormValidator extends Validator<TParentData, unknown> | undefined = undefined

• TData extends DeepValue<TParentData, TName> = DeepValue<TParentData, TName>

Implements

  • OnInit
  • OnChanges
  • OnDestroy
  • FieldOptions<TParentData, TName, TFieldValidator, TFormValidator, TData>

Constructors

new TanStackField()

new TanStackField<TParentData, TName, TFieldValidator, TFormValidator, TData>(): TanStackField<TParentData, TName, TFieldValidator, TFormValidator, TData>

Returns

TanStackField<TParentData, TName, TFieldValidator, TFormValidator, TData>

Properties

api

api: FieldApi<TParentData, TName, TFieldValidator, TFormValidator, TData>;

Defined in

tanstack-field.directive.ts:61


asyncAlways?

optional asyncAlways: boolean;

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

Implementation of

FieldOptions.asyncAlways

Defined in

tanstack-field.directive.ts:50


asyncDebounceMs?

optional asyncDebounceMs: number;

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

Implementation of

FieldOptions.asyncDebounceMs

Defined in

tanstack-field.directive.ts:49


defaultMeta?

optional defaultMeta: Partial<FieldMeta>;

An optional object with default metadata for the field.

Implementation of

FieldOptions.defaultMeta

Defined in

tanstack-field.directive.ts:59


defaultValue?

optional defaultValue: NoInfer<TData>;

An optional default value for the field.

Implementation of

FieldOptions.defaultValue

Defined in

tanstack-field.directive.ts:48


name

name: TName;

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

Implementation of

FieldOptions.name

Defined in

tanstack-field.directive.ts:44


tanstackField

tanstackField: FormApi<TParentData, TFormValidator>;

Defined in

tanstack-field.directive.ts:52


unmount()?

optional unmount: () => void;

Returns

void

Defined in

tanstack-field.directive.ts:76


validatorAdapter?

optional validatorAdapter: TFieldValidator;

A validator provided by an extension, like yupValidator from @tanstack/yup-form-adapter

Implementation of

FieldOptions.validatorAdapter

Defined in

tanstack-field.directive.ts:51


validators?

optional validators: NoInfer<FieldValidators<TParentData, TName, TFieldValidator, TFormValidator, TData>>;

A list of validators to pass to the field

Implementation of

FieldOptions.validators

Defined in

tanstack-field.directive.ts:56

Methods

ngOnChanges()

ngOnChanges(): void

A callback method that is invoked immediately after the default change detector has checked data-bound properties if at least one has changed, and before the view and content children are checked.

Returns

void

Implementation of

OnChanges.ngOnChanges

Defined in

tanstack-field.directive.ts:88


ngOnDestroy()

ngOnDestroy(): void

A callback method that performs custom clean-up, invoked immediately before a directive, pipe, or service instance is destroyed.

Returns

void

Implementation of

OnDestroy.ngOnDestroy

Defined in

tanstack-field.directive.ts:84


ngOnInit()

ngOnInit(): void

A callback method that is invoked immediately after the default change detector has checked the directive's data-bound properties for the first time, and before any of the view or content children have been checked. It is invoked only once when the directive is instantiated.

Returns

void

Implementation of

OnInit.ngOnInit

Defined in

tanstack-field.directive.ts:78