shadcn.io is not affiliated with official shadcn/ui
Affinity Quiz Pricing Block for React
A four-question personality quiz that matches visitors to a plan: the headline beside the quiz, lettered answer cards, and a result with the matched plan, its price and each plan's share of the answers.
Installation
Overview
Turn plan selection into a conversation with this affinity quiz pricing section, shown here for Pebblenote, a journaling app with Free, Plus and Family plans. The quiz is the first thing on the page: the headline sits beside it on wide screens, split by a solid hairline divider with + marks at the corners of the quiz column, and stacks above it on a phone. Four questions about how people write each offer three lettered answers as choice cards in a Radio Group; a thin Progress bar along the quiz card's top fills as visitors answer, and the footer's Steps dots, answer count and Back and Next buttons let them move through the questions and return to any they've answered. Each answer gives a point to one plan, and the result names the visitor's type ("The Devotee") with the plan that matches, how much of the answers it matched, its price and highlights, a breakdown of every plan's share (neutral bars, the match darkest), a Shine Button call to action and a way to retake the quiz. Built with Card, Steps, Radio Group, Field, Progress, Badge, Shine Button, Button, Guides and Lucide icons, with CSS transitions only. For consumer apps, creative tools and any product where personal fit matters more than a feature comparison.
FAQ
How do I change the questions, answers and plans?
Edit the two arrays at the top of the file. Each entry in QUESTIONS has an id, the prompt, a helper line, a short topic (read out on its step dot) and its answers, each with its letter, its label and the plan it gives a point to; give every plan an answer in every question. PLANS holds each plan's id, name, persona (the type the result is headed with), signature, monthly price (0 shows "Free"), the billing line under it, bullets, and its call to action's cta and href. The plan with the most points wins, a tie goes to the plan listed first, and the match percentage is the share of answers that pointed to it; to weigh answers differently, give each one points per plan and add them up in tallyOf.
How do I send the matched plan to checkout?
The result's call to action is a link to the matched plan's href. Point each plan's href at your checkout or sign-up route with the plan in it (/checkout?plan=family), and add the answers to the address if you want them on the customer's record, so your sales team sees why the plan was suggested.
It's a ShineButton with render set to an a element and nativeButton={false}.
Is the quiz accessible to keyboard and screen reader users?
Yes. Each question is an h3, and its answers are a radio group named by the question and described by its helper line: Tab reaches the group and the arrow keys choose an answer. Back and Next move between questions, and the new question's heading takes focus, so reading starts where the content changed; a polite live region also says "Question 2 of 4", and then the match. The step dots are named after their question ("Question 1, Your habit"), and the ones past the first unanswered question are disabled. The result is named by its match line and the plan's name, the price reads "per month", and the breakdown is a list of plans and percentages, with its bars hidden from screen readers.
Why doesn't choosing an answer jump to the next question?
The arrow keys choose an answer in a radio group, so jumping ahead on every choice would skip questions for keyboard users and move screen reader users without warning. Choosing only selects: Next is enabled once the question is answered, and the last one says "See my match". Visitors can go back with Back or a step dot and change an answer, which keeps the rest; "Retake quiz" clears every answer and starts again from the first question.
How does the quiz fit a phone?
The headline stacks above the quiz on a phone and sits beside it from the lg breakpoint. The answers are one column of cards that grow with their text, so long answers wrap rather than overflow, and the quiz card starts at the top of its column on desktop so the first question is on screen without scrolling. The footer keeps the step dots and the answer count on one line and moves Back and Next under them when the screen is narrow. On the result, the highlights stack, then form two columns from sm, and the plan names in the breakdown shorten with an ellipsis before the bars do.
When should I use an affinity quiz instead of a plan comparison?
Use an affinity quiz when the difference between plans is about how people live with the product (alone or with family, a line a day or a ritual) rather than a list of specs: a few questions about habits lead to a plan that feels chosen for the visitor. Use a comparison table or plan cards when buyers already know what they need and want to check limits and features side by side.
Related
- 123Pro
Stepper Wizard Pricing
Plan findersA three-question wizard in one ruled band, with numbered steps, the question beside its answer cards and Back and Next, that recommends a plan, then shows its price, features and a summary of the answers.
- Pro
Plan Recommender Pricing
Plan findersA needs checklist for picking a plan: tick what you need and the cheapest plan that covers every need lights up with its price, while each need says which plan it starts at.
- Pro
Usage Profile Pricing
CalculatorsA monthly estimate for Light, Standard and Heavy usage of a speech-to-text API: choosing a profile rolls the total, resizes a tall stacked bar of where the bill comes from and updates each cost line.
- Pro
Audience Tabs Pricing
Plan cardsThree large audience tiles in the header row (freelancer, studio, agency) that open their own plans: cells that share hairlines on desktop, one plan at a time behind a segment group on a phone.
- Pro
ROI Calculator Pricing
CalculatorsAn ROI calculator for a workflow-automation tool: sliders for team size and hours saved a week feed one display-size figure, the net savings a month, with the value of the time, the seat cost and the return under it.
- Pro
Pricing With FAQ
Proof and guaranteesPlans answered by the pricing FAQ for an e-commerce builder: a compact plan list, a row each with its name, price and call to action, beside an accordion of six questions with the first one open, in one ruled band.