Skip to content

toolmark-monorepo / @toolmark/react/rhf / RhfAdapterOptions

Interface: RhfAdapterOptions<V> ​

Defined in: packages/react/src/rhf/index.ts:17

Options for rhfAdapter.

Type Parameters ​

V ​

V extends FieldValues

Properties ​

elementFor? ​

optional elementFor?: (path) => Element | null

Defined in: packages/react/src/rhf/index.ts:27

Resolves a field's mounted element, for anchors and sensitive-field redaction (spec §13, §14). Defaults, when root is given, to the first [name="<path>"] under root().

Without root or elementFor there are no elements, hence no element rule: password / cc-* fields are not detected and must be declared in the form tool's sensitive.

Parameters ​

path ​

string

Returns ​

Element | null


onSubmit ​

onSubmit: (values) => unknown

Defined in: packages/react/src/rhf/index.ts:19

Called with the validated values on a successful submit; may be sync or async.

Parameters ​

values ​

V

Returns ​

unknown


root? ​

optional root?: () => Element | null

Defined in: packages/react/src/rhf/index.ts:34

The element that contains the form's fields (usually the <form>), read on every use. Gives the form automatic anchors ([name="<path>"] lookup, when elementFor is absent), the sensitive-element rule (password / cc-* inputs are redacted from state()), and focus / submit interaction events. Without it only input interaction events are emitted.

Returns ​

Element | null