Questionnaire
A multi-step form that asks one question at a time, with single-choice, multiple-choice, freeform and skippable questions.
These are the headless parts of Questionnaire, which the styled Questionnaire is built on. Only the active item is shown. Previous, Skip, Next and Submit move through the items, validating the active one first.
Anatomy
Import the primitives and assemble the parts:
@using Blazix.Primitives
<QuestionnaireRoot>
<QuestionnaireProgress />
<QuestionnaireItem>
<QuestionnaireTitle />
<QuestionnaireDescription />
<QuestionnaireChoices>
<QuestionnaireChoice>
<QuestionnaireChoiceInput />
<QuestionnaireChoiceLabel />
<QuestionnaireChoiceShortcut />
</QuestionnaireChoice>
<QuestionnaireInput />
</QuestionnaireChoices>
<QuestionnaireError />
</QuestionnaireItem>
<QuestionnairePrevious />
<QuestionnaireSkip />
<QuestionnaireNext />
<QuestionnaireSubmit />
</QuestionnaireRoot>Keyboard
- Ctrl+Enter (Cmd+Enter on macOS) confirms the active item.
- ↑ and ↓ move between the item's answers, and ← and → between items.
- Enter on a filled answer confirms it.
- With
Shortcutsset, letters (A–Z) or numbers (1–9) select answers.
API Reference
QuestionnaireRoot
Renders a <form> element.
Other attributes are passed to the element it renders.
QuestionnaireProgress
Renders a <div> element.
Other attributes are passed to the element it renders.
QuestionnaireItem
Renders a <fieldset> element.
Other attributes are passed to the element it renders.
QuestionnaireTitle
Renders a <legend> element.
Other attributes are passed to the element it renders.
QuestionnaireDescription
Renders a <p> element.
Other attributes are passed to the element it renders.
QuestionnaireChoices
Renders a <div> element.
Other attributes are passed to the element it renders.
QuestionnaireChoice
Renders a <label> element.
Other attributes are passed to the element it renders.
QuestionnaireChoiceInput
Renders a <input> element.
Other attributes are passed to the element it renders.
QuestionnaireChoiceLabel
Renders a <span> element.
Other attributes are passed to the element it renders.
QuestionnaireChoiceShortcut
Renders a <span> element.
Other attributes are passed to the element it renders.
QuestionnaireInput
Renders a <input> element.
Other attributes are passed to the element it renders.
QuestionnaireError
Renders a <p> element.
Other attributes are passed to the element it renders.
QuestionnairePrevious
Renders a <button> element.
Other attributes are passed to the element it renders.
QuestionnaireSkip
Renders a <button> element.
Other attributes are passed to the element it renders.
QuestionnaireNext
Renders a <button> element.
Other attributes are passed to the element it renders.
QuestionnaireSubmit
Renders a <button> element.
Skip, Next and Submit render the same data attributes as Previous.
Other attributes are passed to the element it renders.