SweetUI

Search items

Jump to an item

block

questionnaire

Composes field, checkbox, textarea, progress, button, card; drives choice, freeform, skippable steps.

questionnairesurveyformmulti-stepshadcn
questionnaire, light

On iPad

The same installed source at a regular width. It adapts its layout without a separate design.

questionnaire on iPad, light

Install

With the sweetui tool (brew install mangobyte-dev/tap/sweetui):

sweetui install questionnaire --destination Sources/YourFeature/Components

Installs in order: input 0.5.1, field 0.1.2, checkbox 0.3.2, textarea 0.4.1, progress 0.2.1, button 0.5.2, card 0.2.1, questionnaire 0.1.1. Point --destination at a folder inside the consuming target's sources.

Usage

@State private var currentStep = 0
@State private var answers: [String: QuestionnaireAnswer] = [:]

Questionnaire(
    "Set up your profile",
    steps: [
        QuestionnaireStep(
            id: "goal",
            title: "What is your main goal?",
            kind: .singleChoice([
                QuestionnaireOption(id: "save", title: "Save more"),
                QuestionnaireOption(id: "invest", title: "Start investing")
            ])
        )
    ],
    currentStep: $currentStep,
    answers: $answers,
    onFinish: { }
)

Accessibility contract

  • Card title: header trait; VoiceOver reaches heading directly.
  • Counter: 'Step N of M', monospaced; ProgressView: 'Progress' label, fraction-value.
  • Step = Field, label = title. Single: inline-Picker, native rows. Multiple: checkbox Toggles per option. Freeform: TextEditor, label = prompt.
  • Step change posts AccessibilityNotification.Announcement of new title; VoiceOver states landing.
  • Back/Skip/Next-or-Finish: explicit-label. Next disabled until answered (unless skippable). Row reflows via ViewThatFits, no truncation.

Details

Kindblock
Version0.1.1
PlatformsiOS 26.0+
Dependenciesfield, checkbox, textarea, progress, button, card
SourceRegistry/sources/blocks/Questionnaire.swift
Xcode previewQuestionnaire