shadcn.io is not affiliated with official shadcn/ui
Wizard FAQ Block for React
A FAQ that shows one question at a time for an analytics tool: a numbered step list, the active question and answer, and Previous and Next buttons in a card in card.
Installation
Overview
A one-question-at-a-time FAQ for React with Base UI. A centred header sits over a card in card: a muted shell with + marks on its corners wraps a raised panel that is light on a light page and dark on a dark one. At the top of the panel a step list numbers the five questions, with each step's name beside its number from md and the numbers alone on a phone; below it the active question and its answer; at the foot, a ghost Previous button and the block's one Shine Button, Next, which becomes Start again on the last question. Every question and answer shares one grid cell, so the panel keeps the height of the longest and nothing moves as the steps change. The page's rails and top rule come from the Guides spine, so the block lines up with its neighbours in a stack. It's built from Steps, Guides, Shine Button and Button, with CSS transitions for the entrance and for each step's slide, and your theme's tokens for every colour. For onboarding pages and product tours where a visitor should meet five answers in order, not twenty at once.
FAQ
How do I change the questions?
Edit QUESTIONS at the top of the file: each entry is an id, the step name shown on the step list, the question and its answer, one to three sentences. The step list, the "Question 2 of 5" count and the panels are all built from that array, so adding or removing an entry is the only change. Keep it to about five to seven: the numbered steps must fit on one row at 320 pixels.
Do visitors have to go in order?
No. Any step in the list can be opened at once: the steps are not locked, because FAQ answers don't depend on one another. Previous and Next walk the list one question at a time, Previous is off on the first question, and Next on the last question starts again at the first.
How does it work with a keyboard and a screen reader?
The step list is a single tab stop; the arrow keys move between steps, Home and End jump to the first and last, and Enter or Space opens the one that has focus. After any step change the new question's heading takes focus, so a screen reader starts reading where the content changed, and a polite live region says "Question 3 of 5". Focus never moves when the page loads.
Why doesn't the card change height between questions?
The five questions and answers are stacked in one grid cell, with an unseen copy of all of them (hidden from assistive technology and out of the tab order) setting the cell's height. The visible panel fits inside it, so Previous and Next stay where they were under your cursor, and the page below never jumps.
What does the Next button do, and can it be a link?
Next is a real button that changes the step on the page, so it stays on the page and doesn't navigate. If the last step should lead somewhere, replace the "Start again" label and handler with a link.
Give the Shine Button render with your link and nativeButton={false}.
What moves, and what happens with reduced motion?
The header and the card fade up once when the page loads, a step's panel slides in a short way from the reading direction when it opens, and the Shine Button's light sweeps across it once on hover and focus. With reduced motion the panel simply appears and the entrances are off. In a right-to-left layout the slide, the Previous arrow and the step order all follow the reading direction.
Related
- Pro
Checklist FAQ
Steps and plansA FAQ you tick off for a booking tool: a progress panel beside seven setup tasks, each a real checkbox with its answer, behind a split divider.
- Pro
Onboarding FAQ
Steps and plansA first-hour plan as an FAQ for a team workspace: five accordion steps down a numbered rail, each with its duration, under a header that adds the minutes up.
- Pro
Progressive Disclosure FAQ
Ways to revealA FAQ for a meal-kit service where every question shows its one-line answer and a Details button opens the longer one: a short list and a note.
- 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
Centered Multi Step Form Hero
Signup and waitlistA centered signup hero whose form is a three-step wizard in a card in card, account, plan and payment, that checks each step's fields before the next and ends on a confirmation.
- Pro
Comparison FAQ
Steps and plansA tier-comparison FAQ for a form builder: column heads for Free, Pro and Enterprise over eight questions, each ending in three tick or dash marks and opening to the detail.