Skip to content
shadcn.io

shadcn.io is not affiliated with official shadcn/ui

Side by Side FAQ Block for React

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.

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 side-by-side FAQ for React with Base UI. Under a compact header, eight rows run from rail to rail between hairlines; each row puts the question and a topic badge at the start and its answer at the end, so every answer is on the page and nothing has to be opened. A quiet link under the last row goes to the support desk. On a phone each answer sits under its question and the list shows four, with a button for the rest. It is built from Badge, Button and Guides, with CSS for the entrance and your theme's tokens for every colour. For shipping, onboarding and policy pages where people compare several answers at a glance.

FAQ

How do I change the questions?

Edit PAIRS at the top of the file: each entry has an id, a topic (the badge), the question and its answer. PHONE_COUNT sets how many rows a phone shows before the button. Eight rows is about the limit before the page gets long; if you have more, group them or use an accordion.

Are all the answers in the page's markup?

Yes, all of them, on every target. The rows are a description list (dl, with the question in dt and the answer in dd), and the rows a phone doesn't show are only hidden with CSS below the md breakpoint, so search engines and screen readers on a desktop see every answer.

What does the button do on a phone?

Below md the list shows the first four rows and a ghost button, "All 8 answers", with aria-expanded and aria-controls; pressing it shows the other four and turns its chevron. The label stays the same and focus stays on the button. From md up every row shows and the button is hidden.

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

There is nothing to operate except the closing link and, on a phone, the All answers button, so Tab visits only those. A screen reader reads the description list as terms and definitions, and the topic badge is part of the term.

  • 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

    Card Grid FAQ

    Cards and grids

    A static FAQ grid for a seed shop: six questions with their answers on show, in cells that share hairlines, each with an icon tile and a topic tag.

  • Pro

    Two-Sided FAQ

    Charts and documents

    A FAQ for a handmade-goods marketplace in one definition list: each question has a buyer's answer and a seller's answer side by side on aligned columns, under a Buyers and Sellers header band.

  • Pro

    Docs Links FAQ

    Reading and sharing

    A FAQ for a mapping service where every answer ends in two guides from the docs, as links with a reading time and an arrow.

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

  • Pro

    Expandable Cards FAQ

    Cards and grids

    An FAQ of six separate cards for a candle subscription, each a collapsible with a topic tag and a round plus that fills in and becomes a minus; the open card lifts.