Questionnaire

Questions asked one at a time, with choices, text answers and progress.

@cupertinoui/questionnaireRegistry JSON

Installation

pnpm dlx shadcn@latest add @cupertinoui/questionnaire

The first install also adds the macOS theme. See Installation to set up the registry.

Usage

import { Questionnaire, QuestionnaireChoice, QuestionnaireChoices, QuestionnaireItem, QuestionnaireNext, QuestionnaireTitle } from "@/components/ui/questionnaire"

<Questionnaire onSubmit={…}>
  <QuestionnaireItem name="platform">
    <QuestionnaireTitle>What are you building?</QuestionnaireTitle>
    <QuestionnaireChoices>
      <QuestionnaireChoice value="mac">A Mac app</QuestionnaireChoice>
    </QuestionnaireChoices>
  </QuestionnaireItem>
  <QuestionnaireNext />
</Questionnaire>
Built on @shadcn/react's headless Questionnaire. Answers are form fields, so onSubmit gets them as FormData.

API Reference

Every part forwards the props of the underlying element. The props below are the ones CupertinoUI adds or changes.

QuestionnaireItem

PropTypeDescription
namestringThe field name of the answer.
multipleboolean
Default: false
Checkboxes instead of radio buttons.
requiredboolean
Default: false
Must be answered to go on.
classNamestringExtra classes, merged with the component's own.