Skip to content
shadcn.io

shadcn.io is not affiliated with official shadcn/ui

Progressive Disclosure FAQ Block for React

A 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.

Framework
UI library

Preview

Preview width

Installation

Part of Pro
Pro unlocks the code and one-line install of every Pro button and text effect, plus the MCP for your AI editor.
Have Pro already? Sign in to open it.Opens here as soon as you're Pro.

Overview

A progressive-disclosure FAQ for React with Base UI. Six questions each show their one-line answer on the page, and a small Details button under it opens the long version: a short list and a "Good to know" note, eased open with a height transition. The start column holds the title, one sentence and an outline link, and stays in view on a wide screen while you read down the questions at the end, behind a split divider that runs from the page's top rule to the block's end. On a phone the header stacks above the questions. 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 Button and Guides, with CSS transitions and your theme's tokens for every colour. For products where most visitors need a sentence and a few need the whole story: allergens, delivery, returns.

FAQ

How do I change the questions?

Edit QUESTIONS at the top of the file. Each entry has an id, the question, the one-line short answer that always shows, more (the list that opens, three lines is the right amount) and note (the closing "Good to know" sentence). Add or remove entries freely; the rows, the button ids and the panels are all built from the list.

How does the Details button work?

It's a ghost Button with aria-expanded and aria-controls pointing at the panel it opens, and its label never changes: the chevron turns to show the state. Each row keeps its own state, so any number of them can be open at once. Its screen-reader name includes the question ("Details: Can you cook around my allergies?"), so six Details buttons are never a list of identical names.

Is the long version in the page's markup when it's closed?

Yes. The panel is a grid row that collapses to zero height and is marked inert, so its text stays in the page for search engines and the browser's source, while its list isn't read by a screen reader or reachable with Tab until you open it. Every target uses the same markup, because the block uses the catalog's Button rather than an Accordion.

What moves, and what happens with reduced motion?

The header and the list fade up once when the page loads, a panel eases open with a grid-rows transition, and the chevron turns. With reduced motion the entrances are off, a panel opens at once and the chevron turns without animating.

How does it fit on a phone?

Below the lg breakpoint the header stacks above the questions and stops being sticky, the rows run from rail to rail under a rule with + marks, and the Details buttons stay a comfortable touch size. The short answers wrap, and nothing scrolls sideways at 320 pixels.

  • Pro

    Toggle All FAQ

    Ways to reveal

    A FAQ for a payroll app with Expand all and Collapse all buttons and a live open count above eight independent hairline rows.

  • Pro

    Accordion FAQ

    Accordion lists

    A 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

    A two-level FAQ for a photo-book shop: an accordion of three sections whose panels each hold an accordion of questions, with a summary of how many of each.

  • Pro

    Minimal FAQ

    Cards and grids

    A type-forward FAQ for a stationery brand: six questions in large type with their answers on show in a definition list, no cards or row lines, and one contact link.

  • Pro

    Numbered FAQ

    Accordion lists

    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.

  • Pro

    Related Questions FAQ

    Reading and sharing

    A cross-linked FAQ for a password manager: every answer ends in two related questions, and choosing one opens that row, scrolls to it and moves focus to its question.