Skip to content
Hazine

Plan Finder Quiz

Pro

A short interview that asks one question per screen, then recommends a plan and lists the answers that led to it. Use when visitors cannot pick a plan from a grid on their own.

How it differs. Sequential: one decision per screen inside a single frame with a step indicator, ending in a result split into the plan and a rail that says which answers set it.

Install

pnpm dlx shadcn@latest add @hazine/plan-finder-quiz

Adds 2 files, 1 shadcn primitive (button), 2 Hazine items (@hazine/heading, @hazine/use-controllable-state), and 1 package (lucide-react).

First time? Add the registry to components.json
{
  "registries": {
    "@hazine": {
      "url": "https://api.hazine.dev/r/{name}.json",
      "headers": { "Authorization": "Bearer ${HAZINE_TOKEN}" }
    }
  }
}

Set HAZINE_TOKEN in your environment. The token comes with a Pro licence.

Props13

title
string = "Find the plan that fits"
questions
FinderQuestion[] = DEFAULT_QUESTIONS
Asked one at a time, in the order given.
plans
FinderPlan[] = DEFAULT_PLANS
Ordered from smallest to largest. The largest plan any answer needs is recommended.
answers
FinderAnswers
defaultAnswers
FinderAnswers = NO_ANSWERS
onAnswersChange
(answers: FinderAnswers) => void
step
number
Index of the question shown. A value equal to questions.length shows the result.
defaultStep
number = 0
onStepChange
(step: number) => void
plansHref
string = "#plans"
Where "Compare all plans" leads.
currency
string = "USD"
ISO 4217 code.
locale
string = "en-US"
headingLevel
HeadingLevel = 2

Also accepts every prop of Omit<React.ComponentProps<"section">, "title">.

Accessibility

Pattern
Radio Group (APG, opens in a new tab), Stepper, Landmarks and headings
Keyboard
Keyboard support for Plan Finder Quiz
KeyEffect
TabMoves through the reachable steps in the indicator, the answer group, Back and Continue. On the result: the plan action, the compare link, each Change button and Start over
Arrow keysMove between the answers of the open question and select the focused one
SpaceSelects the focused answer
EnterOn an answer or on Continue, opens the next question, or the result after the last one. With no answer chosen, shows an error and focuses the first answer
Enter or Space on BackOpens the previous question with its answer kept and moves focus to its heading
Enter or Space on a visited stepOpens that step and moves focus to its heading
Enter or Space on ChangeOpens the question behind that answer
Enter or Space on Start overClears every answer and opens the first question
Screen reader

A section labelled by its heading. Each step is a form with one fieldset of native radios, named by a legend that holds the question heading. The step indicator is an ordered list in a nav with aria-current on the open step. Reachable steps are buttons, not links, because they change the view and not the address. Focus moves to the new heading on every step change, a missing answer is reported through an alert and marks the group invalid, and the recommended plan is announced in a status region together with the answers that set it.

  • Announces: Choose one answer to continue.
  • Announces: Recommended plan: {plan}, {price} {unit}. {answers that set the plan}
Reduced motion
No motion. Colour transitions only.
Checked
Not checked yet. Automated results appear here once CI has run.

Dependencies4

  • button
  • @hazine/heading
  • @hazine/use-controllable-state
  • lucide-react

Filled chips are registry items the CLI adds for you. Outlined chips are npm packages.

Tokens shipped0

None. The item is styled by the tokens your theme already has.

More in Pricing