Skip to content
LuoForge/Tungsten
Components/FormProvider

FormProvider

Access the surrounding form's state and field-registration API. Throws when

used outside a FormProvider.

Install

Add the package and import the component.

pnpm add @hey-mike/tungsten
pnpm add @hey-mike/tungsten
import { FormProvider } from '@hey-mike/tungsten';
import { FormProvider } from '@hey-mike/tungsten';

Props

Surface specific to <FormProvider />.

PropTypeDefaultDescription
children*ReactNode
defaultValuesValues{}Initial field values.
validate(values: Values) => ErrorsForm-level (cross-field) validation, e.g. confirm-password. Runs on submit AFTER per-field validation; its error map is merged over per-field errors. This is the ceiling per ADR-0003 — no async, no field arrays.
onValid(values: Values) => voidCalled with the collected values only when all validation passes.

Source