Embed a FHIR Questionnaire in any web page
The QuestionnaireRenderer widget is the runtime of the FHIR Questionnaire Builder, packaged as a self-contained, embeddable component. Give it a FHIR R4 Questionnaire and it renders a live, fillable form that runs the SDC logic — enableWhen, calculatedExpression, constraints and validation — and hands back a valid QuestionnaireResponse.
- In-page and multi-instance — put several forms on one page; each keeps its own answers, calculations and validation state.
- Vanilla ES module — no React, Vue or Angular required; it works with any stack.
- Host-driven — the widget has no menus of its own: you switch features on through a
configobject and drive it through a small public API and events.
Live demo
The same Annual Health Check questionnaire in three independent widgets, one per preview mode, each with search, live validation and explain turned on through config. The Export FHIR R4 buttons are ordinary host-page buttons that call the widget’s getResponse().
previewMode: preview (design)
previewMode: patient (fill)
previewMode: json
Install
Pin to a release tag so the files never change underneath you; the tags are listed on the GitHub Releases page.
CDN (no install, no account)
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/sergeymosyakov/fhir-questionnaire-builder@widget-vX.Y.Z/dist/questionnaire-widget.css">
<script type="module">
import { QuestionnaireRenderer } from 'https://cdn.jsdelivr.net/gh/sergeymosyakov/fhir-questionnaire-builder@widget-vX.Y.Z/dist/questionnaire-widget.js';
</script>
npm
npm install @sergeymosyakov/questionnaire-widget
NuGet (Blazor, Razor Pages, MVC)
dotnet add package FhirQuestionnaireWidget
Quick start
<link rel="stylesheet" href="questionnaire-widget.css">
<div id="form"></div>
<script type="module">
import { QuestionnaireRenderer } from './questionnaire-widget.js';
const questionnaire = await (await fetch('my-questionnaire.json')).json();
const widget = new QuestionnaireRenderer(document.getElementById('form'), {
questionnaire,
config: { previewMode: 'patient', validation: true },
});
widget.on('response-changed', qr => console.log('answers now:', qr));
</script>
That renders the questionnaire as a patient-facing form with a live PASS/FAIL validation badge. The full reference — every config option, the public API, events, styling and browser support — is in WIDGET.md, and the Embed the renderer guide walks through it step by step.
Need a questionnaire to embed? Build one in the Builder or start from a ready-made template.