Reference headless
formField
# CreateFormFieldOptions
Type Parameters
T
Members
id?optional id?: stringinitialValueinitialValue: T###### Inherited from
CreateFormFieldInput.initialValueonValidityChange?optional onValidityChange?: (state) => voidonValueChange?optional onValueChange?: (value) => void###### Parameters
###### value
T###### Returns
voidreadValue?optional readValue?: (node) => TRead the value from the DOM on
INPUT. Default for<input>isel.value. Pass a custom reader for richer inputs.###### Parameters
###### node
HTMLElement###### Returns
TvalidateOn?optional validateOn?: ValidateOn | readonly ValidateOn[]Default 'blur'.
validator?optional validator?: StandardSchemaV1<T, T> | StandardSchemaV1<unknown, T>writeValue?optional writeValue?: (node, value) => voidWrite the value to the DOM when SET.VALUE / RESET fires. Default for
<input>isel.value = String(v).###### Parameters
###### node
HTMLElement###### value
T###### Returns
void
# 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
# FormFieldController
Type Parameters
T
Members
contextreadonly context: Readonly<FormFieldContext<T>>descriptionreadonly description: AttachmentdescriptionIdreadonly descriptionId: stringdirtyreadonly dirty: booleanerrorsreadonly errors: AttachmenterrorsIdreadonly errorsId: stringidreadonly id: stringinputreadonly input: AttachmentinputIdreadonly inputId: stringinvalidreadonly invalid: booleanlabelreadonly label: AttachmentlabelIdreadonly labelId: stringmachinereadonly machine: FormFieldMachine<T>statereadonly state: FormFieldStatetouchedreadonly touched: booleanvalidatingreadonly validating: booleanvaluereadonly value: Treset()reset(): void###### Returns
voidsetErrors()setErrors(issues): voidInject errors from outside the validator (e.g. SvelteKit form actions, superforms, server-returned issues). Drives the machine through
validating→valid(empty issues) |invalid(non-empty), so theErrorslive-region announces the change exactly as a local validator run would.The string-array shorthand maps each entry to
{ message }.###### Parameters
###### issues
readonly
string[] | readonlyFieldIssue[]###### Returns
voidsetValue()setValue(value): void###### Parameters
###### value
T###### Returns
voidsubscribe()subscribe(listener): () => void###### Parameters
###### listener
(
snapshot) =>void###### Returns
() =>
voidvalidate()validate(): Promise<void>Manually trigger validation (e.g. from a parent form's submit).
###### Returns
Promise<void>
# StandardSchemaV1
Subset of the Standard Schema v1 type surface that Kumiki depends on.
Standard Schema is a type contract, not a runtime dependency — the validator implementation is supplied by the consumer (Zod 3.24+, Valibot 1.x, ArkType 2.0+, Effect Schema 3.x, …).
Type Parameters
InputOutput
Members
\_input?readonly optional _input?: Input~standardreadonly ~standard: object readonly validate: (value) => StandardSchemaResult<Output> | Promise<StandardSchemaResult<Output>> readonly vendor: string readonly version: 1###### validate
###### Parameters
###### value
unknown###### Returns
StandardSchemaResult<Output> |Promise<StandardSchemaResult<Output>>###### vendor
###### version
# Attachment
Attachment = (node) => void | (() => void)Parameters
nodeHTMLElement
Returns
void | (() => void)# 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"# StandardSchemaResult
StandardSchemaResult<Output> = { issues?: undefined; value: Output; } | { issues: ReadonlyArray<{ message: string; path?: ReadonlyArray<PropertyKey>; }>; }Result from a Standard Schema validator's validate() call.
Type Parameters
Output
# ValidateOn
ValidateOn = "blur" | "change" | "submit"# createFormField ( )
createFormField<T>(options): FormFieldController<T>Type Parameters
T
Parameters
optionsCreateFormFieldOptions<T>
Returns
FormFieldController<T>