Theming
The adapters are headless. They ship no markup and no CSS. You render every element and own all of the styling. There is nothing to override, reset, or fight with.
This is deliberate. A survey embedded in your site should look like your site. The SDK gives you data and behavior. Your design system gives it a body.
What you control
Section titled “What you control”Everything visual:
- The layout of each step, the question controls (inputs, selects, radios, checkboxes), buttons, progress indicators, error and validation text, the patient-info form, and the disqualified and complete screens.
- How you map
question.typeto a control. EachV2Questioncarriestype,options,required,helpText, andtext. Types are strings chosen when Apex authors a survey section, so render the ones you recognise and fall back to a text input for the rest. The engine gives onlymulti_selectspecial handling: its answer is an array, and a visiblemulti_selectthe patient never touched is submitted as[]. - Option grouping. A
V2QuestionOptionmay carry agroupstring, for example a body-system category for a long list of conditions. Cluster options under subheadings bygroupif it suits your design, or ignore it.
Progress is yours to present too. stepIndex and totalSteps count the flattened steps; each FlatStep also carries sectionTitle, sectionDescription, stepTitle, and stepDescription if you want section headings or a section-level progress bar.
Optional branding from Apex
Section titled “Optional branding from Apex”A composed survey may include a branding block you can apply if you want the survey to reflect the branding configured for your partner account:
flow.state.composed?.branding// → { logoUrl?: string; primaryColor?: string; companyDisplayName?: string }Use it or ignore it. It is just data. The composed survey also lists the drugs it covers under composed.drugs as { drugId, name?, description? }, which is handy for a heading such as “Qualification for Drug A”.
Accessibility and UX notes
Section titled “Accessibility and UX notes”Because you own the markup, you also own accessibility. A few suggestions:
- Render
validationErrorin an element withrole="alert"so screen readers announce it. - Associate
helpTextwith its control througharia-describedby. - Use
question.textas the visible label. Displayoption.text ?? option.valuefor choices and submitoption.value. Do not displayvaluedirectly: it is often a slug. - Mark required questions visually. The engine blocks Next until every visible required question has an answer, but the patient should know which ones before they click.
- Disable Next while
submittingis true, and show a waiting state instead of the form during thesubmittingphase, to prevent double submissions. - Move focus to the step heading after each step change so keyboard and screen-reader users are not left at the bottom of the previous step.
- Use
type="date"fordob(the engine expectsYYYY-MM-DD) and constrainstateto a two-letter code.
Want a pre-styled drop-in?
Section titled “Want a pre-styled drop-in?”These packages intentionally do not ship one. If you need a zero-build <script> widget with default styles, talk to Apex. That is a separate deliverable, not part of the headless packages.