Skip to content

@jsvision/forms / Field

Interface: Field<T> ​

Defined in: types.ts:25

A single field's handle: its live, store-owned raw value signal plus the derived error / touched / dirty accessors. Handles are stable — form.field(name) returns the same instance every call — so a UI can bind to one shared signal.

Type Parameters ​

T ​

T

Properties ​

name ​

readonly name: string

Defined in: types.ts:27

The field name (a schema key).


value ​

readonly value: Signal<T>

Defined in: types.ts:29

The store-owned raw editing signal; bind a widget straight to it (writes are two-way).

Methods ​

asyncError() ​

asyncError(): string | null

Defined in: types.ts:48

The latest non-superseded async validation message, or null. This is a distinct surface from error() (which stays the synchronous ZodIssue): an async message is never fabricated into a ZodIssue. Cleared to null the moment the value changes (a verdict describes one specific value). Compose the two surfaces yourself in the UI.

Returns ​

string | null


dirty() ​

dirty(): boolean

Defined in: types.ts:35

Whether the raw value differs from its baseline.

Returns ​

boolean


error() ​

error(): $ZodIssue | null

Defined in: types.ts:31

The first validation issue for this field, or null when the field has none.

Returns ​

$ZodIssue | null


touched() ​

touched(): boolean

Defined in: types.ts:33

Whether the field has been interacted with (blur) or a submit was attempted.

Returns ​

boolean


validating() ​

validating(): boolean

Defined in: types.ts:41

Whether an async validation for this field is currently in flight. Always false for a field with no asyncValidators entry. Stays false during the debounce window — it flips true only once the validator is actually running.

Returns ​

boolean