Skip to content

toolmark-monorepo / @toolmark/inertia / inertiaAdapter

Function: inertiaAdapter() ​

inertiaAdapter<V>(form, opts): FormAdapter<V>

Defined in: packages/inertia/src/inertia-adapter.ts:71

Bridges @inertiajs/react's useForm() to Toolmark form tools (spec §8.1, §10.1). Call it on every render with the latest useForm() result; per-form state (the working values and the dirty-tracking snapshot) survives across renders in a module-level map keyed by form.setData.

Type Parameters ​

V ​

V extends Record<string, unknown>

Parameters ​

form ​

InertiaFormLike<V>

The useForm() result (or a structurally compatible object).

opts ​

submit names the visit's method and URL; elementFor resolves a field's DOM element for anchors and redaction (spec §14).

elementFor? ​

(path) => Element | null

submit ​

{ method: "delete" | "post" | "put" | "patch"; url: string; }

submit.method ​

"delete" | "post" | "put" | "patch"

submit.url ​

string

Returns ​

FormAdapter<V>

A FormAdapter for useFormTool / createFormTools.