Reference machines
formField
interface 3 type 3 function 1
# CreateFormFieldInput
Type Parameters
T
Members
initialValueinitialValue: T
# FieldIssue
One validation issue. Aligns with Standard Schema's Issue shape so users can pipe result.issues straight in without remapping.
Members
messagereadonly message: stringpath?readonly optional path?: readonly PropertyKey[]
# FormFieldContext
Type Parameters
T
Members
dirtydirty: booleanTrue when value differs from initialValue.
errorserrors: readonly FieldIssue[]initialValuereadonly initialValue: Ttouchedtouched: booleanTrue once the field has lost focus at least once.
validationTokenvalidationToken: numberToken emitted with each VALIDATE intent. The attachment uses it to guard async resolutions so a stale validator can't overwrite fresher state. Monotonically increasing across the field's lifetime.
valuevalue: T
# FormFieldEvent
FormFieldEvent<T> = { type: "FOCUS"; } | { type: "INPUT"; value: T; } | { type: "BLUR"; } | { type: "SUBMIT_REQUEST"; } | { issues: ReadonlyArray<FieldIssue>; token: number; type: "VALIDATION_RESOLVE"; } | { reason: unknown; token: number; type: "VALIDATION_REJECT"; } | { type: "RESET"; } | { type: "SET.VALUE"; value: T; }Type Parameters
T
# FormFieldMachine
FormFieldMachine<T> = Machine<FormFieldContext<T>, FormFieldEvent<T>, FormFieldState>Type Parameters
T
# FormFieldState
FormFieldState = "pristine" | "editing" | "validating" | "valid" | "invalid"# createFormFieldMachine ( )
createFormFieldMachine<T>(input): FormFieldMachine<T>Construct a fresh FormField machine.
Type Parameters
T
Parameters
inputCreateFormFieldInput<T>
Returns
FormFieldMachine<T>