Skip to content
shadcn.io

shadcn.io is not affiliated with official shadcn/ui

Collapsible Groups FAQ Block for React

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

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 collapsible-groups FAQ for React with Base UI. Four topic bands run from rail to rail, each a collapsible with an icon, a name, a question count and a chevron. A group that is open shows its questions and answers all at once, three side by side, so there is nothing more to click inside it; the first two start open and the last two closed. Each band's rule carries + marks where it meets the rails. On a phone the answers stack inside each group. It is built from Collapsible, Badge and Guides, with CSS for the entrance and your theme's tokens for every colour. For help pages where readers pick a topic, then read everything in it.

FAQ

How do I change the groups and questions?

Edit GROUPS at the top of the file: each group has an id, a title, an open flag (whether it starts open) and pairs, each with an id, a question and an answer. The count in each band is derived. The icon for a group comes from GroupIcon: add a branch for a new id, or swap the lucide icons.

Do groups close each other?

No. Each group is its own Collapsible, so any number can be open at once, and opening one never moves the focus.

Are the closed groups' answers in the page's markup?

Yes. The Collapsible keeps its panel mounted and only collapses it, so a closed group's answers stay in the markup.

How does it work with a keyboard and a screen reader?

Each band's name is a button inside an h3; Tab moves from band to band, and Enter or Space opens or closes it. The button says whether the group is expanded. Inside an open group the questions and answers are a description list, so a screen reader reads them as terms and definitions. There are no arrow-key shortcuts between groups.

What moves, and what happens with reduced motion?

The header fades up once when the page loads, a group's panel eases open and the chevron turns. With reduced motion the entrance is off and the chevron turns without animating. The panel still eases its height over 200 milliseconds.

  • 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

    A sidebar FAQ for a holiday-rental site: a topic rail with two collapsible groups and a live count, beside a filtered list, and a native select on phones.

  • Pro

    Categorized FAQ

    Topics and filters

    A topic-tabbed FAQ for a bookkeeping app: a compact header, a band of line tabs with a count on each, and one accordion per topic.

  • 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

    Side by Side FAQ

    Cards and grids

    An always-open FAQ for a freight carrier: eight questions with their answers side by side in hairline rows, the question and topic at the start and the answer at the end.

  • Pro

    Compact FAQ

    Accordion lists

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