Skip to main content

Questionnaire

Ant Design

The Questionnaire component asks a series of questions one at a time, with Back and Next buttons and a progress bar, for surveys, onboarding forms and intake checklists.

Properties​

Property
Description
Expected Value
ItemsThe questions, each with a unique name, a prompt and a type of single, multiple or text. Choice questions list their choices; add required: true to make an answer needed, or other: true to offer a free-text Other choice.Array
Default answersAnswers filled in at the start, keyed by question name, such as { "role": "Finance" }.Object
ShortcutsKeys that pick a choice: letters for A, B, C, numbers for 1, 2, 3, or none. A key hint shows on each choice.letters, numbers, none. Default: letters
Show progressShows a progress bar above the question.On or off. Default: On
Submit labelText on the button of the last question, which submits the answers.Text. Default: Submit
Complete titleHeading shown after the answers are submitted.Text. Default: Thank you
Complete textText shown under the heading after the answers are submitted.Text. Default: Your answers were submitted.
BorderedDraws a border around the questionnaire.On or off. Default: On

Additional Actions​

Each of these can be switched on or off, or set with a logical expression by clicking fx.

Property
Description
Expected Value
VisibilityShows or hides the component. Hidden components keep their space unless Collapse when hidden is on.On or off. Default: On
Collapse when hiddenRemoves the hidden component's space, so the components below it move up.On or off. Default: Off
Loading stateShows the component's loading look and blocks interaction, for example while a query runs.On or off. Default: Off
DisableStops the user from interacting with the component.On or off. Default: Off

Devices​

Property
Description
Expected Value
Show on desktopShows the component in the desktop layout.On or off. Default: On
Show on mobileShows the component in the mobile layout.On or off. Default: Off

Events​

Add a handler from the Events section of the properties panel. See Event Triggers for the steps.

Event
Description
On step changedTriggers when the question shown changes.
On submitTriggers when the user submits the last question and every required question is answered.

Component Specific Actions (CSA)​

Run these from an event handler with Control Component, or from a RunJS query. See Component Specific Actions.

Action
Description
How To Access
ResetClears the answers back to Default answers and returns to the first question.components.questionnaire1.reset()
Go toShows the question at the given Position or name, a position counting from 0 or a question name. After a submit, it reopens the questions for editing.components.questionnaire1.goTo("")
Set visibilityShows the component when true, hides it when false.components.questionnaire1.setVisibility(false)
Set disableDisables the component when true, enables it when false.components.questionnaire1.setDisable(false)
Set loadingTurns the loading state on with true, off with false.components.questionnaire1.setLoading(false)

Exposed Variables​

Variable
Description
How To Access
itemsThe questions, each with a unique name, a prompt and a type of single, multiple or text. Choice questions list their choices; add required: true to make an answer needed, or other: true to offer a free-text Other choice.{{components.questionnaire1.items}}
defaultAnswersAnswers filled in at the start, keyed by question name, such as { "role": "Finance" }.{{components.questionnaire1.defaultAnswers}}
shortcutsKeys that pick a choice: letters for A, B, C, numbers for 1, 2, 3, or none. A key hint shows on each choice.{{components.questionnaire1.shortcuts}}
showProgressShows a progress bar above the question.{{components.questionnaire1.showProgress}}
submitLabelText on the button of the last question, which submits the answers.{{components.questionnaire1.submitLabel}}
completeTitleHeading shown after the answers are submitted.{{components.questionnaire1.completeTitle}}
completeTextText shown under the heading after the answers are submitted.{{components.questionnaire1.completeText}}
borderedDraws a border around the questionnaire.{{components.questionnaire1.bordered}}
answersThe answers keyed by question name: the picked choice for single, a list of choices for multiple, and the text for text.{{components.questionnaire1.answers}}
currentIndexPosition of the question shown, counting from 0.{{components.questionnaire1.currentIndex}}
currentItemThe question shown, as { name, prompt, type }.{{components.questionnaire1.currentItem}}
isCompletetrue after the answers are submitted.{{components.questionnaire1.isComplete}}
isVisibleWhether the component is visible.{{components.questionnaire1.isVisible}}
isLoadingWhether the component is in its loading state.{{components.questionnaire1.isLoading}}
isDisabledWhether the component is disabled.{{components.questionnaire1.isDisabled}}

Styles​

Style
Default
Primary colorTheme: Brand primary
Text colorTheme: Primary text
Container backgroundTheme: Surface 1
Border colorTheme: Default border
Border radius—
Box shadow0px 0px 0px 0px #00000040

A default that starts with Theme: follows the app's theme until the style is set to another value. See App Themes.