shadcn.io is not affiliated with official shadcn/ui
Numbered FAQ Block for React
A numbered FAQ for a wine club: eight accordion rows from rail to rail, with a margin of tabular numerals, 01 to 08, behind a hairline; the open row's numeral turns to full strength.
Installation
Overview
A numbered FAQ for React with Base UI. A start-aligned title and sentence sit above a band of eight accordion rows that run from rail to rail under a rule with + marks. At the start of every row is a margin of tabular numerals, 01 to 08, in a monospace face, behind a hairline that runs the height of the band and meets the rule with a + mark; answers are indented to sit beside the questions, not under the numbers. The open row's numeral turns to full strength and a small arrow at the end of the row turns over. 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 Accordion and Guides, with CSS transitions for the entrance and your theme's tokens for every colour. For onboarding and member pages where the order of the questions matters a little, or where a number makes an answer easy to cite.
FAQ
How do I change the questions?
Edit QUESTIONS at the top of the file: each entry is an id, the question and its answer, one to three sentences. The numerals are made from each row's position, zero-padded, so adding, removing or reordering a row renumbers the rest. OPEN_QUESTION names the one that's open on load. Eight fit the layout. One answer is open at a time.
Add multiple to the Accordion to let several stay open.
Are the closed answers in the page's markup?
Yes. Each Accordion takes hiddenUntilFound, so every closed answer stays in the markup as hidden="until-found": search engines see all 8, and the browser's find in page opens the answer that holds a match.
How does it work with a keyboard and a screen reader?
Each question is a button inside its own h3 under the section's h2, so a screen reader's headings list shows every question. Tab moves from question to question, Enter or Space opens and closes one, and the button says whether it's expanded. The open answer is labelled by its question. The numerals are decorative and hidden from assistive technology, so a screen reader reads the question alone.
How is the numeral margin built?
The numerals sit in a fixed-width column at the start of each trigger, and the same width is the indent of every answer, so the two stay aligned. The hairline is a narrow absolute box the same width, drawn by Guides, which gives it + marks where it crosses the band's top rule. On a phone the margin is narrower, and the numerals and the line stay.
What moves, and what happens with reduced motion?
The header and the band fade up once when the page loads, with CSS transitions. The numeral's colour and the arrow's turn change as a row opens. With reduced motion the entrances are off and the arrow flips without turning. The answers also open and close at once, with no height animation.
Related
- Pro
Accordion FAQ
Accordion listsA side-header FAQ for a web analytics tool: the title, one sentence and a contact prompt beside seven questions in an accordion, behind a split divider.
- Pro
Compact FAQ
Accordion listsA dense FAQ for ski-lift passes: ten tight accordion rows with small type and one-sentence answers in a narrow framed list, a chevron at the start of each row.
- Pro
Dual Column Accordion FAQ
Accordion listsA two-column FAQ for a pottery studio: a start-aligned header, then two independent accordions of four questions side by side, behind a split divider.
- 123Pro
Centered Three-Step Process Hero
Updates and timelinesA compact centred how-it-works hero for an invoicing app: a headline, a Shine Button with an outline action and trust copy over a closing band of three step cells, each with a small drawing of its screen.
- 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.
- Pro
Collapsible Groups FAQ
Accordion listsA grouped FAQ for a grocery-delivery service: four topic bands that collapse as a whole, each holding its questions as always-visible answers, the first two open.