Skip to main content
Version: 0.1.2

Function: formState()

Imported from @react-logic/utils

formState<S>(schema): FormHandle<S>

Build a reactive form. Returns a callable signal — form() produces an atomic FormSnapshot (values, errors, touched, dirty, plus aggregate valid / pristine / submitting / submitted).

Schema is recursive — use formGroup for nested objects. Empty {} is a text field with '' initial. kind: 'checkbox' defaults to false. Built-in validator factories live next to this module.

Type Parameters

S

S extends Schema

The schema. Use the const modifier so validator-name literals propagate to errors typing.

Parameters

schema

S

Returns

FormHandle<S>