Form Generator · Module-specific types
Module-specific types
Keep specialised UI next to the feature that owns it. Do not grow FormGenerator’s core switch / registry for one-off flows.
-
Create the component under the module, e.g.
pages/YourModule/formQuestions/YourQuestion/. -
Export a type string in local
questionTypes.js(e.g.YourType: 'yourQuestionType'). -
Map it in local
questionRenderers.js:[YourQuestionTypes.YourType]: (_ctx, question, container, commonConfig) => new YourQuestion(container, { data: { ...question, ...commonConfig } }) -
Pass
questionRenderers: yourModuleRenderersintonew FormGenerator(…)on every page that uses that type. -
Return the matching
questionTypestring from the Steps API for that flow.
Reference implementation:
src/client/pages/HouseholdAccounts/formQuestions/
wired from Youth Starter Offer, Player Details, and Household Add Member.
For a full walkthrough see Creating a new question component.