tuil
ReferencePackages@mwillbanks/tuil-formAPI

TanStackFieldLike

interface exported by @mwillbanks/tuil-form.

View rawEdit

interface

Public interface exported by @mwillbanks/tuil-form.

export interface TanStackFieldLike<T> {
  readonly name: string;
  readonly state: {
    readonly value: T;
    readonly meta: {
      readonly errors: readonly unknown[];
      readonly isTouched: boolean;
      readonly isDirty: boolean;
      readonly isValidating: boolean;
    };
  };
  readonly handleChange: (value: T) => void;
  readonly handleBlur: () => void;
  readonly validate?: (
    cause: "change" | "blur" | "submit",
  ) => unknown | Promise<unknown>;
  readonly reset?: () => void;
  readonly store?: {
    readonly subscribe: (
      observer: () => void,
    ) => (() => void) | { readonly unsubscribe: () => void };
  };
}

Members

MemberTypeRequiredDescriptionRelated types
namestringYesThe name member uses the string contract.
state&#123; readonly value: T; readonly meta: &#123; readonly errors: readonly unknown[]; readonly isTouched: boolean; readonly isDirty: boolean; readonly isValidating: boolean; &#125;; &#125;YesThe state member uses the &#123; readonly value: T; readonly meta: &#123; readonly errors: readonly unknown[]; readonly isTouched: boolean; readonly isDirty: boolean; readonly isValidating: boolean; &#125;; &#125; contract.
handleChange(value: T) => voidYesThe handleChange member uses the (value: T) => void contract.
handleBlur() => voidYesThe handleBlur member uses the () => void contract.
validate((cause: "change" | "blur" | "submit") => unknown | Promise<unknown>) | undefinedNoThe validate member uses the ((cause: "change" | "blur" | "submit") => unknown | Promise<unknown>) | undefined contract.
reset(() => void) | undefinedNoThe reset member uses the (() => void) | undefined contract.
store&#123; readonly subscribe: (observer: () => void) => (() => void) | &#123; readonly unsubscribe: () => void; &#125;; &#125; | undefinedNoThe store member uses the &#123; readonly subscribe: (observer: () => void) => (() => void) | &#123; readonly unsubscribe: () => void; &#125;; &#125; | undefined contract.

Parameters

This declaration has no public members.

Returns

This declaration does not return a value.

Throws

No thrown errors are documented for this declaration.

No package-local related types.

Source

View the secondary source reference

Package

@mwillbanks/tuil-form

On this page