Questionnaire
One-question-at-a-time stepped survey with Apple-styled single/multi-select option cards, keyboard letter/number shortcuts, Liquid Glass text inputs, and Previous / Skip / Next navigation.
Built on @shadcn/react/questionnaire primitives and fully compatible with the standard shadcn/ui JSX API (Questionnaire / QuestionnaireProgress / QuestionnaireItem / QuestionnaireTitle / QuestionnaireDescription / QuestionnaireChoices / QuestionnaireChoice / QuestionnaireInput / QuestionnaireError / QuestionnaireActions and navigation buttons):
- One question at a time: Displays only the active question;
QuestionnaireProgresstracks progress and prevents advancing past unanswered required items with an error prompt. - Option cards: Default to Liquid Glass cells reacting to the global glass tint (automatically switching to Over-Glass flat fills inside glass Cards; pass
glass={false}forBorderedfills). Selected cards show an accent tint and 1.5px accent border with circular radio dots or rounded-square checkmarks matchingRadioGroup/Checkbox. - Keyboard shortcuts: Pass
shortcuts="letters"or"numbers"on the root to display A / B / C keycaps and enable instant key selection. - Native library controls: Text questions render Liquid Glass
Input, and navigation buttons renderButtonwith Apple press physics, all automatically adapting to Over-Glass inside glass Cards. - Responsive typography: Question title 20px (iOS
Title 3) ↔ 15px (macOS), options 17px ↔ 13px, 52px minimum option height on mobile.
Installation (Shadcn Registry)
npx shadcn@latest add @apple-liquid/questionnaireInside a Glass Card
Usage
import {
Questionnaire,
QuestionnaireActions,
QuestionnaireChoice,
QuestionnaireChoices,
QuestionnaireItem,
QuestionnaireNext,
QuestionnairePrevious,
QuestionnaireProgress,
QuestionnaireSubmit,
QuestionnaireTitle,
} from '@/components/ui/questionnaire';
export function Example() {
return (
<Questionnaire shortcuts="letters" onSubmit={(event) => event.preventDefault()}>
<QuestionnaireProgress />
<QuestionnaireItem name="platform" required>
<QuestionnaireTitle>Which platform do you primarily use?</QuestionnaireTitle>
<QuestionnaireChoices>
<QuestionnaireChoice value="macos">macOS</QuestionnaireChoice>
<QuestionnaireChoice value="ios">iOS</QuestionnaireChoice>
</QuestionnaireChoices>
</QuestionnaireItem>
<QuestionnaireActions>
<QuestionnairePrevious>Previous</QuestionnairePrevious>
<QuestionnaireNext>Next</QuestionnaireNext>
<QuestionnaireSubmit>Submit</QuestionnaireSubmit>
</QuestionnaireActions>
</Questionnaire>
);
}QuestionnaireProgress displays "Question 1 of 3" by default and can be customized via its render prop, e.g. render={(props, state) => <div {...props}>Step {state.current} / {state.total}</div>}. Navigation buttons follow <LiquidGlassProvider locale={lang}>.
Props API
Questionnaire
| Prop | Type | Default | Description |
|---|---|---|---|
shortcuts | 'letters' | 'numbers' | — | Enable letter or number keyboard shortcuts for choices |
defaultItem / item | string | — | Initial / controlled active question name |
onItemChange | (item: string) => void | — | Callback fired when switching questions |
onSubmit | FormEventHandler | — | Native <form> submit handler |
QuestionnaireItem
| Prop | Type | Default | Description |
|---|---|---|---|
name | string | — | Field name for the question (required) |
multiple | boolean | false | Multi-select (checkbox) mode |
required | boolean | false | Marks the question as required |
QuestionnaireChoice
| Prop | Type | Default | Description |
|---|---|---|---|
value | string | — | Option value (required) |
disabled | boolean | false | Disable the option |
glass | boolean | true | Liquid Glass control material; false renders 100% opaque Bordered fill; auto-switches to Over-Glass on glass surfaces |
surface | 'default' | 'over-glass' | Auto-detected | Manually override surface context |
Navigation buttons (QuestionnairePrevious / QuestionnaireSkip / QuestionnaireNext / QuestionnaireSubmit) support Button's variant and size props (defaulting to outline / ghost / default / default).
Language & Text
Questionnaire accepts locale and messages, which apply to all of its parts and the overlays it opens and win over the global <LiquidGlassProvider locale messages>. To override the text globally, put it under messages.questionnaire on the provider. See Liquid Glass → Global settings.
| Prop | Type | Description |
|---|---|---|
locale | LiquidGlassLocaleInput | UI language of this component (any BCP 47 tag; unsupported ones fall back to English) |
messages | Partial<QuestionnaireMessages> | Text overrides, merged over the built-in text and the global messages.questionnaire |
| Key | Built-in text (English) |
|---|---|
previous | Previous |
skip | Skip |
next | Next |
submit | Submit |
Progress
Apple 27 linear progress indicator featuring a capsule track with 0.5px hairline stroke, solid accent fill, sm/default sizes, and indeterminate shimmer animation.
RadioGroup
Responsive Apple Liquid Glass radio group adapting between 22px mobile touch rings and 16px macOS 27 precision radio buttons, with group-level size/glass inheritance and spring inner dots.