Skip to main content

Interface: FormRendererProps

Defined in: types.ts:624

Properties

autosave?

optional autosave?: boolean | AutosaveOptions;

Defined in: types.ts:647


className?

optional className?: string;

Defined in: types.ts:655


classNames?

optional classNames?: PartClassNames;

Defined in: types.ts:689

Per-part class names, keyed by component and then by part (docs/12 §5.1).

classNames={{ TextField: { input: 'input input-bordered' } }}

Keyed by component first because part names like root and input repeat across components. Values may be functions of the part's state. These ADD to the default class rather than replacing it, and the default comes first, so a host class wins in the cascade at equal specificity.


datasets?

optional datasets?: Readonly<Record<string, DatasetIndex>>;

Defined in: types.ts:640

Preloaded dataset indexes by name, for the source: 'server' datasets a definition declares but does not carry (docs/17 §2.3 EngineOptions.datasets). Without these, a dataset-backed choice list resolves to zero choices — the engine has no I/O of its own and cannot fetch the rows.

Build one with createDatasetIndex(rows, { keyField }) from @rasd/core. Inline datasets in the definition are indexed automatically and only need an entry here to override them. A new map identity after mount is applied through engine.invalidateDataset(), so late-arriving rows (a sync that finished, a district list downloaded on demand) reach an open interview.


definition

definition: FormDefinition;

Defined in: types.ts:625


fallback?

optional fallback?: ReactNode;

Defined in: types.ts:710

Rendered while the definition, storage or a stored draft is being read (docs/06 §3.1). A form opened on a submissionId reads that submission before it builds an engine — see FormRenderer — so this is what the enumerator looks at during that read.


id?

optional id?: string;

Defined in: types.ts:656


initialData?

optional initialData?: Record<string, unknown>;

Defined in: types.ts:627


locale?

optional locale?: string;

Defined in: types.ts:641


mode?

optional mode?: RenderMode;

Defined in: types.ts:643


persist?

optional persist?: boolean;

Defined in: types.ts:646

false disables the storage write even when the provider has an adapter.


readOnly?

optional readOnly?: boolean;

Defined in: types.ts:642


renderers?

optional renderers?: Readonly<Record<string,
| ElementComponent<unknown>
| undefined>>;

Defined in: types.ts:654

Per-form component overrides by element type, highest priority in the resolution order. Read through a ref so an inline object literal cannot invalidate the field contexts on every keystroke — which also means a changed map only takes effect for hosts that remount or re-key the form.


styles?

optional styles?: PartStyles;

Defined in: types.ts:691

Per-part inline styles, same keying as classNames (docs/12 §5.1).


submissionId?

optional submissionId?: string;

Defined in: types.ts:626


unstyled?

optional unstyled?: boolean;

Defined in: types.ts:697

Render without assuming the default stylesheet (docs/06 §15). Available per form as well as per provider: a host with one styled form and one that lives inside their own design system had no way to say so.


validateOn?

optional validateOn?: ValidateOn;

Defined in: types.ts:644

Methods

onChange()?

optional onChange(event): void;

Defined in: types.ts:657

Parameters

ParameterType
eventChangeEvent

Returns

void


onComplete()?

optional onComplete(event): void;

Defined in: types.ts:698

Parameters

ParameterType
event{ message?: string; trigger: string; }
event.message?string
event.triggerstring

Returns

void


onError()?

optional onError(error): void;

Defined in: types.ts:662

Parameters

ParameterType
errorunknown

Returns

void


onFinalize()?

optional onFinalize(submission): boolean | void | Promise<boolean | void>;

Defined in: types.ts:659

Parameters

ParameterType
submissionSubmission

Returns

boolean | void | Promise<boolean | void>


onInvalid()?

optional onInvalid(event): void;

Defined in: types.ts:660

Parameters

ParameterType
event{ errors: FieldIssue[]; page: number; }
event.errorsFieldIssue[]
event.pagenumber

Returns

void


onPageChange()?

optional onPageChange(index, reason): void;

Defined in: types.ts:661

Parameters

ParameterType
indexnumber
reasonPageChangeReason

Returns

void


onReady()?

optional onReady(api): void;

Defined in: types.ts:674

Receives the imperative FormApi whenever it changes, and null on unmount.

useRasdForm() is the normal way to reach the form and covers everything a host renders inside it. This exists for a host that is not a React component at all — <rasd-form> in @rasd/element must answer validate() / finalize() / getData() from outside React, and the context carrying the API is created by this component, so nothing above it can subscribe.

Parameters

ParameterType
apiFormApi | null

Returns

void


onSave()?

optional onSave(submission): void;

Defined in: types.ts:658

Parameters

ParameterType
submissionSubmission

Returns

void


onTriggerAction()?

optional onTriggerAction(
id,
payload,
ctx
): void;

Defined in: types.ts:703

A custom trigger action fired (docs/17 §3.2). The engine has no idea what it means — the host does.

Parameters

ParameterType
idstring
payloadunknown
ctx{ trigger: string; }
ctx.triggerstring

Returns

void