Skip to content
shadcn.io

shadcn.io is not affiliated with official shadcn/ui

Multi Select FAQ Block for React

A topic-chip FAQ for an outdoor-gear rental: any number of chips can be on, and the list shows the union of their questions, with a live count.

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 multi-select FAQ for React with Base UI. Under a compact header, a band holds five topic chips with the number of questions in each; any number can be on, and a pressed chip turns solid. The list below shows every question from the topics that are on, or all ten when none is, a line under the chips says what it holds ("2 topics, 4 of 10 questions") and a Clear button turns the chips off again. The chips wrap onto two lines on a phone rather than scrolling. It's built from Toggle, Accordion, Button and Guides, with your theme's tokens for every colour. For FAQs where one question often belongs to several concerns and visitors want to combine them.

FAQ

How do I change the topics and questions?

Edit TOPICS (an id and a label) and QUESTIONS (an id, the question, its answer and the topic it belongs to) at the top of the file. The number on each chip is counted from QUESTIONS, and so is the line under the chips. A question belongs to one topic; to let it match several, give it a topics array and test it with some.

Why does turning on a second chip add questions instead of narrowing the list?

The chips are a union: a question shows when any of the topics that are on matches it. With none on, every question shows. If you want an intersection, switch the filter from includes to every over a topics array.

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

The chips are toggle buttons in a fieldset named "Topics": Tab moves between them, Space or Enter turns one on or off, and each one says whether it's pressed. The count under them is a polite live region, so a change is announced without moving focus. Each question is a button inside its own h3.

Does the page jump when the list shrinks?

The list keeps a minimum height of about five rows, so even the shortest result leaves the block's closing line where the eye expects it, and the Clear button stays in place (hidden, not removed) while no chip is on. A list that shrinks from ten rows to two does still get shorter, as the visitor asked it to.

Are the hidden questions still in the page's markup?

No: a question that doesn't match is removed from the page, not hidden, so only what the chips show is rendered. If search engines should see every answer, render the unfiltered list on the server and filter it in the browser, or add structured data built from QUESTIONS.

  • Pro

    Tags FAQ

    Topics and filters

    A tagged FAQ for a children's book club: a side header with a tag cloud, and questions that carry their own tag buttons, both filtering the same list.

  • 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

    Topic Select FAQ

    Topics and filters

    A short FAQ for a bike-share with a topic Select at the end of its header: choose a topic and its questions fill the rows below, or choose All topics for all twelve.

  • Pro

    A searchable FAQ for a notes app: a start-aligned header, a band with a full-width search field and a live count, and ten questions that filter as you type, open every match and mark the matched words.

  • Pro

    Difficulty FAQ

    Topics and filters

    An FAQ for a coding school where every question has a level: a three-bar glyph and a badge on each row, and a level filter with counts beside the list.

  • Pro

    Sortable FAQ

    Topics and filters

    A FAQ for a garden-planner app whose questions really sort: a three-way control in a narrow start column reorders eight rows by most asked, newest or A to Z.