suiss/ui · Component
Questionnaire
A step-by-step form that shows one question at a time, with validation, skipping and keyboard shortcuts.
Questionnaire is an open-source component from suiss/ui for React, React Native, SwiftUI and Jetpack Compose. The @esuiss/ui CLI copies its source into your project, so you own the code.
Questionnaire renders a form that presents a sequence of questions, one at a time. Each QuestionnaireItem is a fieldset with a QuestionnaireTitle, an optional QuestionnaireDescription, an answer area and a QuestionnaireError. Answers are either QuestionnaireChoices holding QuestionnaireChoice cards (with optional QuestionnaireChoiceDescription), or a QuestionnaireInput.
QuestionnaireProgress shows the current position, and QuestionnaireActions lays out QuestionnairePrevious, QuestionnaireSkip, QuestionnaireNext and QuestionnaireSubmit, which show and hide themselves based on the current question. Use Questionnaire for onboarding flows and surveys; use Field and regular form controls when all fields should be visible at once.
Installation
Works in any project with a components.json. See Installation for the one-line registry setup. Or use the suiss/ui CLI:
Usage
Composition
Use the following composition to build a Questionnaire:
Examples
With shortcuts
Set shortcuts="letters" on Questionnaire to label the choices with letter keys, so pressing a letter selects the matching answer. Shortcut badges are hidden below the md breakpoint.
Number shortcuts
Set shortcuts="numbers" to label the choices with number keys from 1 to 9.
Multiple choice
Set multiple on an item to render its choices as checkboxes. This one has a default selection with defaultChecked, a disabled choice and a custom error message.
With choice descriptions
Add a QuestionnaireChoiceDescription inside a choice to give the card a secondary description.
Text input
Use QuestionnaireInput with type="email" for a free-form answer. The item is required, so Next stays blocked until it is answered.
Start on later question
Set defaultItem to the name of an item to open the questionnaire on it, here the second question.
Accessibility
- Each item is a
fieldsetnamed by itslegendtitle; inactive items arehiddenandinert. - Choices are native radio buttons or checkboxes inside a
label. A choice description is linked witharia-describedby. QuestionnaireInputis labelled by the question title unless you passaria-label.- The item's description and, when invalid, its error are linked with
aria-describedby. The error usesrole="alert"and focus moves to the invalid answer. QuestionnaireProgresshasrole="progressbar", anaria-labelofQuestionnaire progress,aria-valuetextandaria-live="polite".- Keyboard: Enter on an answered control advances or submits; Command or Control plus Enter advances from anywhere; ArrowUp and ArrowDown move between answers; outside text fields and radio buttons, ArrowLeft goes back and ArrowRight goes forward once the question has an answer. The active item lists these in
aria-keyshortcuts. - Hidden navigation buttons are
aria-hidden,inertand removed from the tab order.
API Reference
Questionnaire
The form root that tracks the active question and handles navigation and submission.
| Prop | Type | Default |
|---|---|---|
defaultItem | string | - |
item | string | - |
items | readonly QuestionnaireItemDefinition[] | - |
onItemChange | (item: string) => void | - |
shortcuts | QuestionnaireShortcutMode | - |
Also accepts the props of React.ComponentProps<"form">.
The first item is shown by default. Use defaultItem to start elsewhere, or item with onItemChange to control the active question; onItemChange is called with the next item's name. Pass items (each with name, required, disabled and choices) to define the sequence and the order used for shortcut keys, instead of deriving them from the rendered items. shortcuts enables single-key answers with letters (A to Z) or numbers (1 to 9). Native browser validation is off by default (noValidate); the component runs its own validation on Next and Submit.
QuestionnaireProgress
Shows the position as text, such as Question 2 of 3, and exposes it to assistive technology with the progressbar role.
Also accepts the props of useRender.ComponentProps<"div", QuestionnaireState>.
Also accepts the props of React.ComponentProps<"div">, plus asChild.
Also accepts the props of React.ComponentProps<"div">, plus a render function.
QuestionnaireItem
A fieldset for one question, visible only while it is active.
| Prop | Type | Default |
|---|---|---|
disabled | boolean | false |
invalid | boolean | false |
multiple | boolean | false |
name | string | Required |
onStatusChange | (status: QuestionnaireItemStatus) => void | - |
required | boolean | false |
Also accepts the props of React.ComponentProps<"fieldset">.
Give every item a unique name; it is used for navigation and answers are submitted as form data under it. A required item blocks Next and Submit until it is answered and hides the Skip button. A disabled item is left out of the sequence. multiple renders the choices as checkboxes instead of radio buttons, and invalid forces the invalid state. onStatusChange is called when the status changes between unanswered, answered and skipped.
QuestionnaireTitle
The question text, rendered as the fieldset's legend.
Also accepts the props of useRender.ComponentProps<"legend">.
Also accepts the props of React.ComponentProps<"legend">, plus asChild.
Also accepts the props of React.ComponentProps<"legend">, plus a render function.
QuestionnaireDescription
Supporting text that describes the question.
Also accepts the props of useRender.ComponentProps<"p">.
Also accepts the props of React.ComponentProps<"p">, plus asChild.
Also accepts the props of React.ComponentProps<"p">, plus a render function.
QuestionnaireChoices
The grid that holds the answer choices.
Also accepts the props of useRender.ComponentProps<"div", { shortcuts: QuestionnaireShortcutMode | null }>.
Also accepts the props of React.ComponentProps<"div">, plus asChild.
Also accepts the props of React.ComponentProps<"div">, plus a render function.
QuestionnaireChoice
A selectable answer card containing a radio button or checkbox.
| Prop | Type | Default |
|---|---|---|
checked | boolean | - |
defaultChecked | boolean | false |
disabled | boolean | false |
onChange | React.ChangeEventHandler<HTMLInputElement> | - |
value | string | Required |
Also accepts the props of useRender.ComponentProps<"label", QuestionnaireChoiceState>.
Also accepts the props of React.ComponentProps<"label">, plus asChild.
Also accepts the props of React.ComponentProps<"label">.
value is submitted for the choice. Use defaultChecked, or checked with onChange, which is called when the underlying input changes. Choices expose data-checked or data-unchecked, plus data-type, data-disabled, data-invalid and data-shortcut.
QuestionnaireChoiceDescription
Secondary text inside a choice that describes it.
Also accepts the props of React.ComponentProps<"span">.
QuestionnaireInput
A text-style input for free-form answers.
| Prop | Type | Default |
|---|---|---|
type | QuestionnaireInputType | "text" |
Also accepts the props of useRender.ComponentProps<"input", QuestionnaireInputState>.
Also accepts the props of React.ComponentProps<"input">, plus asChild.
Also accepts the props of React.ComponentProps<"input">, plus a render function.
type can be text, email, number, date or url, among others. The input exposes data-filled or data-empty.
QuestionnaireError
The validation message shown when the question needs an answer.
Also accepts the props of useRender.ComponentProps<"p", { invalid: boolean }>.
Also accepts the props of React.ComponentProps<"p">, plus asChild.
Also accepts the props of React.ComponentProps<"p">, plus a render function.
For required items the default text is Choose an answer to continue.; pass children to replace it.
QuestionnaireActions
Lays out the navigation buttons in one row.
Also accepts the props of React.ComponentProps<"div">.
QuestionnairePrevious, QuestionnaireSkip, QuestionnaireNext and QuestionnaireSubmit show and hide themselves based on the current question. Their variant and size are the Button props, and they expose data-visible or data-hidden.
QuestionnairePrevious
Goes back to the previous question; hidden on the first.
| Prop | Type | Default |
|---|---|---|
variant | "default" | "outline" | "secondary" | "tinted" | "ghost" | "plain" | "destructive" | "link" | "outline" |
size | "default" | "xs" | "sm" | "lg" | "xl" | "form" | "icon" | "icon-xs" | "icon-sm" | "icon-lg" | "icon-xl" | "default" |
Also accepts the props of useRender.ComponentProps<"button">.
Also accepts the props of React.ComponentProps<"button">, plus asChild.
Also accepts the props of React.ComponentProps<"button">, plus a render function.
QuestionnaireSkip
Skips the current optional question; hidden when the question is required.
| Prop | Type | Default |
|---|---|---|
variant | "default" | "outline" | "secondary" | "tinted" | "ghost" | "plain" | "destructive" | "link" | "outline" |
size | "default" | "xs" | "sm" | "lg" | "xl" | "form" | "icon" | "icon-xs" | "icon-sm" | "icon-lg" | "icon-xl" | "default" |
Also accepts the props of useRender.ComponentProps<"button">.
Also accepts the props of React.ComponentProps<"button">, plus asChild.
Also accepts the props of React.ComponentProps<"button">, plus a render function.
QuestionnaireNext
Validates the current question and moves to the next; hidden on the last.
| Prop | Type | Default |
|---|---|---|
variant | "default" | "outline" | "secondary" | "tinted" | "ghost" | "plain" | "destructive" | "link" | "default" |
size | "default" | "xs" | "sm" | "lg" | "xl" | "form" | "icon" | "icon-xs" | "icon-sm" | "icon-lg" | "icon-xl" | "default" |
Also accepts the props of useRender.ComponentProps<"button">.
Also accepts the props of React.ComponentProps<"button">, plus asChild.
Also accepts the props of React.ComponentProps<"button">, plus a render function.
QuestionnaireSubmit
Submits the form; shown only on the last question.
| Prop | Type | Default |
|---|---|---|
variant | "default" | "outline" | "secondary" | "tinted" | "ghost" | "plain" | "destructive" | "link" | "default" |
size | "default" | "xs" | "sm" | "lg" | "xl" | "form" | "icon" | "icon-xs" | "icon-sm" | "icon-lg" | "icon-xl" | "default" |
type | "submit" | "reset" | "button" | "submit" |
Also accepts the props of useRender.ComponentProps<"button">.
Also accepts the props of React.ComponentProps<"button">, plus asChild.
Also accepts the props of React.ComponentProps<"button">, plus a render function.
Each part sets a data-slot, such as questionnaire-item or questionnaire-choice, for styling.
Web preview
Questionnaire is a View that tracks which question is active, collects answers and validates them. Each QuestionnaireItem is one question; only the active item is shown, and moving between items slides the content horizontally with a Reanimated keyframe that follows the layout direction.
Items hold QuestionnaireChoice rows, which are Pressable radios or, with multiple, checkboxes, or a QuestionnaireInput for a typed answer. QuestionnaireActions holds the Previous, Skip, Next and Submit buttons, each of which only appears when it applies.
Installation
- Install the following dependencies:
-
Copy the primitives it uses into
components/primitives:
- Copy and paste the following code into
components/ui/questionnaire.tsx:
- Update the import paths to match your project setup.
- Install the following dependencies:
-
Copy the primitives it uses into
components/primitives:
- Copy and paste the following code into
components/ui/questionnaire.tsx:
- Update the import paths to match your project setup.
- Install the following dependencies:
-
Copy the primitives it uses into
components/primitives:
- Copy and paste the following code into
components/ui/questionnaire.tsx:
- Update the import paths to match your project setup.
-
Target iOS 17 or later.
-
Add the Swift package to your app:
- Copy the theme files every view uses:
- Copy the source and every file it uses:
- Add the files to your app target.
- Apply the Compose compiler plugin, enable Compose, set
compileSdkto 37 or higher andminSdkto 24 or higher, and add the dependencies:
- Copy the theme files every view uses:
- Copy the source and every file it uses:
- Update the
com.esuiss.uipackage names to match your project.
Usage
Examples
Mid flow
Set defaultItem to start on the second question. Control the active item with item and onItemChange instead.

Invalid
A required item blocks moving on without an answer and shows QuestionnaireError, which appears only when the item is invalid.

Multiple choice
Set multiple on an item to accept several checked choices. Its answer is collected as a string array.
Web preview
With choice descriptions
Add a QuestionnaireChoiceDescription inside a choice to give it secondary text.
Web preview
Text input
Use QuestionnaireInput for a typed answer to a required question.
Web preview
Accessibility
- Each item has the
radiogrouprole, orgroupwhenmultiple, and is labelled by itsQuestionnaireTitle, which has theheadingrole. - Choices have the
radioorcheckboxrole with checked and disabled states. QuestionnaireInputis labelled by the title unless you pass anaccessibilityLabel.QuestionnaireProgresshas theprogressbarrole, a value such as "Question 2 of 3" and a polite live region.QuestionnaireErrorhas thealertrole with a polite live region.- Slide transitions respect the system reduce motion setting.
API Reference
Questionnaire
Root that holds the state and the active question.
| Prop | Type | Default |
|---|---|---|
items | QuestionnaireItemDefinition[] | - |
item | string | - |
defaultItem | string | - |
onItemChange | (item: string) => void | - |
onSubmit | (values: QuestionnaireValues) => void | - |
Also accepts the props of React.ComponentProps<typeof View>, React.RefAttributes<View>, UseQuestionnaireParameters.
items lists the questions in order, each with a name and optional required and disabled. The active item is uncontrolled through defaultItem or controlled with item and onItemChange. onSubmit is called when the last question is submitted and receives the collected values: a string for single-answer items and a string array for multiple items. Moving between items slides the content horizontally, and the direction flips for right-to-left layouts. Use useQuestionnaireContext to build custom controls, or useQuestionnaire for the underlying state.
QuestionnaireProgress
Shows the current question number and total.
| Prop | Type | Default |
|---|---|---|
children | | React.ReactNode | ((state: QuestionnaireState) => React.ReactNode) | - |
Also accepts the props of React.ComponentProps<typeof View>, React.RefAttributes<View>.
It shows "Question 1 of 3" by default. Pass a function as children to render your own content from the questionnaire state.
QuestionnaireItem
One question; shown only while active.
| Prop | Type | Default |
|---|---|---|
name | string | Required |
required | boolean | false |
disabled | boolean | false |
invalid | boolean | false |
multiple | boolean | false |
onStatusChange | (status: QuestionnaireItemStatus) => void | - |
Also accepts the props of React.ComponentProps<typeof View>, React.RefAttributes<View>.
Give every item a unique name; its answer is collected under that name. A required item blocks moving on without an answer and hides Skip. A disabled item is removed from the sequence. onStatusChange is called when the status changes to unanswered, answered or skipped.
QuestionnaireTitle
The question heading.
Also accepts the props of Text.
QuestionnaireDescription
Secondary text under the title.
Also accepts the props of Text.
QuestionnaireChoices
Stack of choice rows.
Also accepts the props of React.ComponentProps<typeof View>, React.RefAttributes<View>.
QuestionnaireChoice
A selectable answer row.
| Prop | Type | Default |
|---|---|---|
value | string | Required |
checked | boolean | - |
defaultChecked | boolean | false |
disabled | boolean | false |
onCheckedChange | (checked: boolean) => void | - |
children | React.ReactNode | - |
Also accepts the props of React.ComponentProps<typeof Pressable>, React.RefAttributes<View>.
Use defaultChecked, or controlled checked with onCheckedChange. Selecting a choice plays a selection haptic when a haptics adapter is provided through HapticsContext.
QuestionnaireChoiceDescription
Secondary text inside a choice.
Also accepts the props of Text.
QuestionnaireInput
Text field for a typed answer.
| Prop | Type | Default |
|---|---|---|
type | QuestionnaireInputType | "text" |
Also accepts the props of React.ComponentProps<typeof Input>.
type is text, email, number, tel, url, password or search, and sets the keyboard, autofill and secure entry.
QuestionnaireError
Validation message shown when the item is invalid.
Also accepts the props of Text.
It has a default message that you can replace with children.
QuestionnaireActions
Row for the navigation buttons.
Also accepts the props of React.ComponentProps<typeof View>, React.RefAttributes<View>.
QuestionnairePrevious
Goes to the previous question.
Also accepts the props of Button.
QuestionnaireSkip
Skips the active question when it is optional.
Also accepts the props of Button.
QuestionnaireNext
Validates and moves to the next question.
Also accepts the props of Button.
QuestionnaireSubmit
Validates all questions and calls onSubmit on the last step.
Also accepts the props of Button.
QuestionnaireItemStatus
Values: .unanswered, .answered, .skipped.
QuestionnaireDirection
Values: .forward, .backward.
QuestionnaireItemDefinition
| Parameter | Type | Default |
|---|---|---|
_Â name | String | - |
required | Bool | false |
multiple | Bool | false |
disabled | Bool | false |
invalid | Bool | false |
| Property | Type |
|---|---|
name | String |
required | Bool |
multiple | Bool |
disabled | Bool |
invalid | Bool |
QuestionnaireController
| Parameter | Type | Default |
|---|---|---|
items | [QuestionnaireItemDefinition]? | nil |
defaultItem | String? | nil |
defaultValues | [String: [String]] | [:] |
| Property | Type |
|---|---|
activeItem | String? |
direction | QuestionnaireDirection |
values | [String: [String]] |
onItemChange | ((String) -> Void)? |
onSubmit | (([String: [String]]) -> Void)? |
sequence | [String] |
total | Int |
current | Int |
isFirst | Bool |
isLast | Bool |
activeItemRequired | Bool? |
activeItemStatus | QuestionnaireItemStatus? |
answers | [String: [String]] |
QuestionnaireController.status
| Parameter | Type | Default |
|---|---|---|
of | String | - |
Returns QuestionnaireItemStatus.
QuestionnaireController.isInvalid
| Parameter | Type | Default |
|---|---|---|
_Â name | String | - |
Returns Bool.
QuestionnaireController.isSelected
| Parameter | Type | Default |
|---|---|---|
_Â value | String | - |
in | String | - |
Returns Bool.
QuestionnaireController.select
| Parameter | Type | Default |
|---|---|---|
_Â value | String | - |
in | String | - |
selected | Bool | true |
QuestionnaireController.toggle
| Parameter | Type | Default |
|---|---|---|
_Â value | String | - |
in | String | - |
QuestionnaireController.text
| Parameter | Type | Default |
|---|---|---|
for | String | - |
Returns String.
QuestionnaireController.setText
| Parameter | Type | Default |
|---|---|---|
_Â text | String | - |
for | String | - |
QuestionnaireController.validate
| Parameter | Type | Default |
|---|---|---|
_Â name | String | - |
Returns Bool.
QuestionnaireController.go
| Parameter | Type | Default |
|---|---|---|
to | String | - |
QuestionnaireController.goPrevious
Takes no parameters.
QuestionnaireController.goNext
Takes no parameters.
Returns Bool.
QuestionnaireController.advance
Takes no parameters.
Returns Bool.
QuestionnaireController.skip
Takes no parameters.
Returns Bool.
QuestionnaireController.submit
Takes no parameters.
Returns Bool.
QuestionnaireController.reset
Takes no parameters.
Questionnaire
Root that holds the state and the active question.
| Parameter | Type | Default |
|---|---|---|
controller | QuestionnaireController | - |
content | () -> Content | - |
QuestionnaireProgress
Shows the current question number and total.
| Parameter | Type | Default |
|---|---|---|
label | (_ current: Int, _ total: Int) -> Label | - |
Overloads: init(label:), init().
QuestionnaireItem
One question; shown only while active.
| Parameter | Type | Default |
|---|---|---|
name | String | - |
required | Bool | false |
multiple | Bool | false |
disabled | Bool | false |
invalid | Bool | false |
onStatusChange | ((QuestionnaireItemStatus) -> Void)? | nil |
content | () -> Content | - |
QuestionnaireTitle
The question heading.
| Parameter | Type | Default |
|---|---|---|
_Â title | LocalizedStringKey | - |
verbatim | String | - |
Overloads: init(_:), init(verbatim:).
QuestionnaireDescription
Secondary text under the title.
| Parameter | Type | Default |
|---|---|---|
_Â description | LocalizedStringKey | - |
verbatim | String | - |
Overloads: init(_:), init(verbatim:).
QuestionnaireChoices
Stack of choice rows.
| Parameter | Type | Default |
|---|---|---|
content | () -> Content | - |
QuestionnaireChoice
A selectable answer row.
| Parameter | Type | Default |
|---|---|---|
value | String | - |
disabled | Bool | false |
label | () -> Label | - |
_Â title | LocalizedStringKey | - |
verbatim | String | - |
Overloads: init(value:disabled:label:), init(_:value:disabled:), init(verbatim:value:disabled:).
QuestionnaireChoiceDescription
Secondary text inside a choice.
| Parameter | Type | Default |
|---|---|---|
_Â description | LocalizedStringKey | - |
verbatim | String | - |
Overloads: init(_:), init(verbatim:).
QuestionnaireInput
Text field for a typed answer.
| Parameter | Type | Default |
|---|---|---|
_Â placeholder | LocalizedStringResource | "" |
keyboard | UIKeyboardType | .default |
contentType | UITextContentType? | nil |
disabled | Bool | false |
QuestionnaireError
Validation message shown when the item is invalid.
| Parameter | Type | Default |
|---|---|---|
_Â message | LocalizedStringKey | - |
verbatim | String | - |
Overloads: init(), init(_:), init(verbatim:).
QuestionnaireActions
Row for the navigation buttons.
| Parameter | Type | Default |
|---|---|---|
content | () -> Content | - |
QuestionnairePrevious
Goes to the previous question.
| Parameter | Type | Default |
|---|---|---|
_Â title | LocalizedStringKey | "Previous" |
variant | VariantButtonStyle.Variant | .outline |
size | VariantButtonStyle.Size | .default |
QuestionnaireSkip
Skips the active question when it is optional.
| Parameter | Type | Default |
|---|---|---|
_Â title | LocalizedStringKey | "Skip" |
variant | VariantButtonStyle.Variant | .outline |
size | VariantButtonStyle.Size | .default |
QuestionnaireNext
Validates and moves to the next question.
| Parameter | Type | Default |
|---|---|---|
_Â title | LocalizedStringKey | "Next" |
variant | VariantButtonStyle.Variant | .default |
size | VariantButtonStyle.Size | .default |
QuestionnaireSubmit
Validates all questions and calls onSubmit on the last step.
| Parameter | Type | Default |
|---|---|---|
_Â title | LocalizedStringKey | "Submit" |
variant | VariantButtonStyle.Variant | .default |
size | VariantButtonStyle.Size | .default |
QuestionnaireItemStatus
Values: Unanswered, Answered, Skipped.
QuestionnaireItemDefinition
| Parameter | Type | Default |
|---|---|---|
name | String | - |
required | Boolean | false |
disabled | Boolean | false |
QuestionnaireState
| Property | Type |
|---|---|
item | String? |
total | Int |
current | Int |
first | Boolean |
last | Boolean |
activeItemRequired | Boolean? |
activeItemStatus | QuestionnaireItemStatus? |
values | Map<String, List<String>> |
QuestionnaireState.status
| Parameter | Type | Default |
|---|---|---|
name | String | - |
Returns QuestionnaireItemStatus.
QuestionnaireState.goTo
| Parameter | Type | Default |
|---|---|---|
name | String | - |
QuestionnaireState.goPrevious
Takes no parameters.
QuestionnaireState.goNext
Takes no parameters.
QuestionnaireState.skipCurrent
Takes no parameters.
QuestionnaireState.submit
Takes no parameters.
QuestionnaireState.reset
Takes no parameters.
rememberQuestionnaireState
| Parameter | Type | Default |
|---|---|---|
defaultItem | String? | null |
items | List<QuestionnaireItemDefinition>? | null |
Returns QuestionnaireState.
useQuestionnaire
Takes no parameters.
Returns QuestionnaireState.
Questionnaire
Root that holds the state and the active question.
| Parameter | Type | Default |
|---|---|---|
modifier | Modifier | Modifier |
state | QuestionnaireState | rememberQuestionnaireState() |
onItemChange | ((String) -> Unit)? | null |
onSubmit | (Map<String, List<String>>) -> Unit | {} |
content | @Composable () -> Unit | - |
QuestionnaireProgress
Shows the current question number and total.
| Parameter | Type | Default |
|---|---|---|
modifier | Modifier | Modifier |
content | (@Composable (current: Int, total: Int) -> Unit)? | null |
QuestionnaireItem
One question; shown only while active.
| Parameter | Type | Default |
|---|---|---|
name | String | - |
modifier | Modifier | Modifier |
required | Boolean | false |
multiple | Boolean | false |
enabled | Boolean | true |
invalid | Boolean | false |
onStatusChange | ((QuestionnaireItemStatus) -> Unit)? | null |
content | @Composable ColumnScope.() -> Unit | - |
QuestionnaireTitle
The question heading.
| Parameter | Type | Default |
|---|---|---|
text | String | - |
modifier | Modifier | Modifier |
QuestionnaireDescription
Secondary text under the title.
| Parameter | Type | Default |
|---|---|---|
text | String | - |
modifier | Modifier | Modifier |
QuestionnaireChoices
Stack of choice rows.
| Parameter | Type | Default |
|---|---|---|
modifier | Modifier | Modifier |
content | @Composable ColumnScope.() -> Unit | - |
QuestionnaireChoice
A selectable answer row.
| Parameter | Type | Default |
|---|---|---|
value | String | - |
modifier | Modifier | Modifier |
checked | Boolean? | null |
onCheckedChange | ((Boolean) -> Unit)? | null |
defaultChecked | Boolean | false |
enabled | Boolean | true |
content | @Composable ColumnScope.() -> Unit | - |
text | String | - |
Overloads: QuestionnaireChoice(value, content), QuestionnaireChoice(text, value).
QuestionnaireChoiceDescription
Secondary text inside a choice.
| Parameter | Type | Default |
|---|---|---|
text | String | - |
modifier | Modifier | Modifier |
QuestionnaireInput
Text field for a typed answer.
| Parameter | Type | Default |
|---|---|---|
modifier | Modifier | Modifier |
value | String? | null |
onValueChange | ((String) -> Unit)? | null |
defaultValue | String | "" |
enabled | Boolean | true |
placeholder | String? | null |
keyboardOptions | KeyboardOptions | KeyboardOptions.Default |
QuestionnaireError
Validation message shown when the item is invalid.
| Parameter | Type | Default |
|---|---|---|
text | String? | null |
modifier | Modifier | Modifier |
QuestionnaireActions
Row for the navigation buttons.
| Parameter | Type | Default |
|---|---|---|
modifier | Modifier | Modifier |
content | @Composable () -> Unit | - |
QuestionnairePrevious
Goes to the previous question.
| Parameter | Type | Default |
|---|---|---|
modifier | Modifier | Modifier |
text | String | "Previous" |
variant | ButtonVariant | ButtonVariant.Outline |
size | ButtonSize | ButtonSize.Default |
enabled | Boolean | true |
QuestionnaireSkip
Skips the active question when it is optional.
| Parameter | Type | Default |
|---|---|---|
modifier | Modifier | Modifier |
text | String | "Skip" |
variant | ButtonVariant | ButtonVariant.Outline |
size | ButtonSize | ButtonSize.Default |
enabled | Boolean | true |
QuestionnaireNext
Validates and moves to the next question.
| Parameter | Type | Default |
|---|---|---|
modifier | Modifier | Modifier |
text | String | "Next" |
variant | ButtonVariant | ButtonVariant.Default |
size | ButtonSize | ButtonSize.Default |
enabled | Boolean | true |
QuestionnaireSubmit
Validates all questions and calls onSubmit on the last step.
| Parameter | Type | Default |
|---|---|---|
modifier | Modifier | Modifier |
text | String | "Submit" |
variant | ButtonVariant | ButtonVariant.Default |
size | ButtonSize | ButtonSize.Default |
enabled | Boolean | true |

