web-form API Reference

createForm(options)

OptionTypeDescription
initialValuesobjectThe starting form state. Defines the shape for register paths.
validate(values) => errorsReturns the path-keyed errors object directly (may be async).
validator(values) => { errors }Returns { errors } — convenient for schema resolvers (may be async).
mode"onChange" | "onBlur" | "onSubmit"When to validate. Default "onBlur".
reValidateMode"onChange" | "onBlur"When to re-validate after the first error. Default "onChange".

Returns a stable form object.

The form object

Methods

MemberDescription
register(path)Returns { name, value, checked, error, isTouched, oninput, onblur } to spread onto an input.
handleSubmit(fn)Returns a submit handler; validates, then calls fn(values) only when valid.
reset(values?)Resets to initialValues, or to values (which become the new baseline).

Reactive state

MemberDescription
valuesReactive proxy of the current values (read nested paths directly).
errorsReactive proxy of current errors, keyed by path.
touchedReactive proxy of blurred fields.
changedReactive proxy of fields changed since mount.

Status flags

FlagDescription
isValidNo errors currently set.
isChangedValues differ from initialValues.
isTouchedAt least one field blurred.
isSubmittingAsync submit in flight.
isValidatingAsync validator running.
isSubmittedA submit completed successfully.
submitCountNumber of submit attempts.

register(path) bindings

PropPurpose
nameThe field path.
valueCurrent value, read reactively from the values store.
checkedSame signal, for checkbox/radio inputs.
errorCurrent error for this path, if any.
isTouchedWhether this field has been blurred.
oninputWrites the input's value (or checked) back to state.
onblurMarks touched and triggers onBlur-mode validation.