HextaUI

Questionnaire: Lift transition and bar

transition="lift" moves questions up and down like a stack. variant="bar" on the progress shows one continuous bar.

"use client"

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

const items = [
  {
    name: "team",
    prompt: "How big is your team?",
    choices: ["Just me", "2–10", "11–50", "More than 50"],
  },
  {
    name: "stage",
    prompt: "Where is your product today?",
    choices: ["Idea", "In development", "Launched"],
  },
  {
    name: "timeline",
    prompt: "When do you want to ship?",
    choices: ["This month", "This quarter", "No rush"],
  },
]

export function QuestionnaireLift() {
  return (
    <div className="w-full max-w-md rounded-xl border p-5">
      <Questionnaire
        transition="lift"
        onSubmit={(event) => event.preventDefault()}
      >
        <QuestionnaireProgress variant="bar" />
        {items.map((item) => (
          <QuestionnaireItem key={item.name} name={item.name} required>
            <QuestionnaireTitle>{item.prompt}</QuestionnaireTitle>
            <QuestionnaireChoices>
              {item.choices.map((choice) => (
                <QuestionnaireChoice key={choice} value={choice}>
                  {choice}
                </QuestionnaireChoice>
              ))}
            </QuestionnaireChoices>
          </QuestionnaireItem>
        ))}
        <QuestionnaireActions>
          <QuestionnairePrevious />
          <QuestionnaireNext />
          <QuestionnaireSubmit />
        </QuestionnaireActions>
      </Questionnaire>
    </div>
  )
}

This adds the example as components/examples/questionnaire/lift.tsx, together with the Questionnaire component and the HextaUI theme tokens it needs.

pnpm dlx shadcn@latest add https://hextaui.com/r/questionnaire-lift.json

To add only the component, follow the Questionnaire installation.

Props in this example

The Questionnaire props this example sets, from the API reference.

PropTypeDefault
transition
"slide" | "lift""slide"
PropTypeDefault
variant
"segments" | "bar""segments"
PropTypeDefault
nameThe form field name.
string–
required
booleanfalse
PropTypeDefault
value
string–

Every prop is in the Questionnaire API reference.

See them all, with keyboard support and accessibility notes, on the Questionnaire page.