currentPage

API / @publicodes/forms / currentPage

function currentPage<RuleName>(params): EvaluatedFormElement & FormPageElementProp[]

Defined in: form.ts:93

Creates a UI representation of the current form page.

Type Parameters

Type ParameterDescription
RuleName extends stringThe existing rule names

Parameters

ParameterTypeDescription
params{ engine: Engine<RuleName>; formState: FormState<RuleName>; }-
params.engineEngine<RuleName>The Publicodes engine instance
params.formStateFormState<RuleName>The current state of the form

Returns

EvaluatedFormElement & FormPageElementProp[]

An array of form elements with their UI properties and validation state

Example

const pageElements = currentPage({ formState, engine })
// Returns array of FormElementInPage to be rendered