API reference
Store
createFormStore and the FormStore interface.
import { createFormStore } from '@easy-forms/core';
const store = createFormStore({ initialValues, validationMode });Most apps never call this — <Form> creates a store internally. Create one yourself to
drive values programmatically or share state across components, then pass it to
<Form store={store}>.
Options
| Prop | Type | Default | Description |
|---|---|---|---|
| initialValues | Record<string, unknown> | — | Initial field values. |
| validationMode | 'onChange' | 'onBlur' | 'onSubmit' | 'all' | — | When fields validate. |
FormStore (selected members)
| Prop | Type | Default | Description |
|---|---|---|---|
| getValue / getValues | () => unknown | — | Read a field or all values. |
| setValue | (key, value, options?) => void | — | Set a value. options: { validate, touch, markDirty }. |
| getFieldState | (key) => FieldState | — | Read a field's full state. |
| getDerived | () => FormDerivedState | — | Aggregate isDirty / isValid / values / errors. |
| validateField / validateAll | (...) => Promise<boolean> | — | Run validation imperatively. |
| resetField / reset | (...) => void | — | Reset one field or the whole form. |
| submit | (handler) => Promise<void> | — | Validate then invoke the handler with values. |
| subscribeField / subscribeForm / subscribeGroup | (…, listener) => unsubscribe | — | Low-level subscriptions (the hooks wrap these). |
SetValueOptions
| Prop | Type | Default | Description |
|---|---|---|---|
| validate | boolean | true | Validate after setting. |
| touch | boolean | false | Mark the field touched. |
| markDirty | boolean | true | Update the dirty flag. Dependency-engine derivations use false. |