Skip to main content

Questionnaire

Rocket 2.0

The Questionnaire component asks a series of questions one at a time, with answer cards, a progress bar and Previous, Skip, Next and Submit buttons. Use it for onboarding flows, surveys or intake forms.

Properties​

Property
Description
Expected Value
ItemsQuestions to ask, in order. Each has a name and a prompt, and can set a description, required, a type of single, multiple or text, choices, an other free-text choice and a placeholder.Array
Default answersAnswers filled in when the questionnaire starts, keyed by question name.Object
Answer shortcutsKeys shown on the answer cards that pick an answer: Letters (A, B, C), Numbers (1, 2, 3) or None.Letters, Numbers, None. Default: Letters
Show progressShows a bar and a count of how far through the questions the user is.On or off. Default: On
Submit button labelText on the button shown on the last question.Text. Default: Submit
Completed titleHeading shown after the user submits.Text. Default: Thanks for your answers
Completed textMessage shown under Completed title after the user submits.Text. Default: We will use them to set up your workspace.
SurfaceCard draws the questionnaire in a bordered box; Plain shows it without one.Card, Plain. Default: Card

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 questionnaire moves to another question.
On submitTriggers when the user submits 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
ResetRestores the default answers and goes back to the first question.components.questionnaire1.reset()
Go to questionMoves to the question given by Index or name, a position starting at 0 or a question's name. It reopens a submitted questionnaire.components.questionnaire1.goTo("{{0}}")
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
itemsQuestions to ask, in order. Each has a name and a prompt, and can set a description, required, a type of single, multiple or text, choices, an other free-text choice and a placeholder.{{components.questionnaire1.items}}
defaultAnswersAnswers filled in when the questionnaire starts, keyed by question name.{{components.questionnaire1.defaultAnswers}}
shortcutsKeys shown on the answer cards that pick an answer: Letters (A, B, C), Numbers (1, 2, 3) or None.{{components.questionnaire1.shortcuts}}
showProgressShows a bar and a count of how far through the questions the user is.{{components.questionnaire1.showProgress}}
submitLabelText on the button shown on the last question.{{components.questionnaire1.submitLabel}}
completeTitleHeading shown after the user submits.{{components.questionnaire1.completeTitle}}
completeTextMessage shown under Completed title after the user submits.{{components.questionnaire1.completeText}}
surfaceCard draws the questionnaire in a bordered box; Plain shows it without one.{{components.questionnaire1.surface}}
answersThe answers keyed by question name: the chosen value for a single choice, a list of values for a multiple choice, and the text for a text question.{{components.questionnaire1.answers}}
currentIndexThe position of the current question, starting at 0.{{components.questionnaire1.currentIndex}}
currentItemThe current question's name, prompt, type and required.{{components.questionnaire1.currentItem}}
isCompleteWhether the user has submitted the questionnaire.{{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
Accent (progress, selected answer, buttons)Theme: Brand primary
BackgroundTheme: Surface 1
Border and answer card borderTheme: Default border
Question colorTheme: Primary text
Description and answer description colorTheme: Placeholder text
Radius—
Question typefaceTheme font
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.