Skip to main content
Docs/Control rendering behavior
On this page ⌄
Usage guide

Control rendering behavior

QuestionnaireConfig display flags, review and read-only flows, and the resolvers that connect a form to your data.

Goal and scope​

Two mechanisms shape a rendered form beyond the Questionnaire resource itself. QuestionnaireConfig sets per-form display behavior and is passed to the composable. DataCaptureConfig holds app-level hooks that resolve external data. This page covers both.

QuestionnaireConfig​

Pass a QuestionnaireConfig as the config parameter to override display defaults.

Questionnaire(
questionnaireJson = questionnaireJson,
config = QuestionnaireConfig(
showReviewPage = true,
showAsterisk = true,
showRequiredText = false,
),
onSubmit = ...,
onCancel = ...,
)
FlagDefaultEffect
showSubmitButtontrueRender the submit button
showCancelButtontrueRender the cancel button
showReviewPagefalseInsert a read-only review step before submission
showReviewPageFirstfalseOpen directly on the review step
isReadOnlyfalseRender the whole form non-editable
showAsteriskfalseMark required questions with *
showRequiredTexttrueLabel required questions with text
showOptionalTextfalseLabel optional questions instead
showNavigationLongScrollfalseNavigation for long single-page scrolling
submitButtonTextnullOverride the submit button label
showSubmitAnywayWhenValidationFailstrueOffer a "submit anyway" path in the validation dialog

Two combinations are worth knowing. showReviewPage gives the standard fill-then-review flow, and isReadOnly with a questionnaireResponseJson is how you display a previously submitted response. Set showSubmitAnywayWhenValidationFails = false when invalid data must never leave the form.

Layout beyond these flags belongs to the Questionnaire resource itself. Paginated versus single-scroll rendering comes from the Questionnaire's SDC item-control extensions, not from the config object.

DataCaptureConfig connects the form to your data​

Some Questionnaire features reference data the SDK cannot know about, such as ValueSets hosted elsewhere, x-fhir-query answer options, and media binaries. DataCaptureConfig carries the resolvers for these, supplied through a CompositionLocal so any Questionnaire below it in the tree is served.

CompositionLocalProvider(
LocalDataCaptureConfig provides DataCaptureConfig(
xFhirQueryResolver = myQueryResolver,
),
) {
Questionnaire(...)
}

These are the hooks.

  • ExternalAnswerValueSetResolver serves answer options declared as a ValueSet URL rather than inline, for choice and open-choice questions.
  • XFhirQueryResolver serves answer options declared as an x-fhir-query.
  • UrlResolver fetches media binaries referenced by URL for item-media display.

A Questionnaire that uses none of these features needs no DataCaptureConfig at all. Custom widget matchers are separate from this config and pass directly to the composable, covered in customize and extend.

Checkpoint​

With showReviewPage = true, submission shows your answers read-only with an edit path before the final submit. If a dropdown backed by an external ValueSet renders empty, the ExternalAnswerValueSetResolver is missing or not finding the ValueSet.

Next step​

Customize and extend covers custom widgets, validation details, and extracting resources from responses.