easy-forms
API reference

Hooks

Subscribe to exactly the slice of form state you need.

All hooks must be used inside a FormStoreProvider — which the ejected <EasyForm> renders for you.

useFormRuntime

const { store } = useFormRuntime(schema, options?);

Owns the store, the merged dependency handlers, and the engine + plugin attachment. This is the headless entry point — see useFormRuntime for the full options table and the mount-order contract.

useField

const field = useField(key: string): UseFieldReturn;

Subscribes to a single field. Returns its value, error, touched/dirty flags, and setters (setValue, setTouched, …). This is what renderers use under the hood.

useFormState

const { isDirty, isValid, isSubmitting, submitCount } = useFormState(store?);

Subscribes to the aggregate form state. Use it to build a custom footer or submit gate.

Added in 0.2

The optional store argument lets a hook that creates a store read it before the provider is rendered below itself — which is how useAdvancedWizard surfaces live per-step error counts. Existing no-argument callers are unaffected.

useFormValues

const values = useFormValues(): Record<string, unknown>;

Subscribes to all current values. Prefer useWatch when you only need a few.

useWatch

const [country, region] = useWatch(['country', 'region']);

Subscribes to just the named fields — efficient for reacting to specific values outside the dependency engine.

useGroup

const group = useGroup(id: string);

Subscribes to a group's runtime props (e.g. its effective hidden).