Skip to content
shadcn.io

shadcn.io is not affiliated with official shadcn/ui

Stats FAQ Block for React

An FAQ for a support tool that opens on a band of four support figures on shared hairlines, then seven questions in an accordion.

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 stats FAQ for React with Base UI. A centred title and sentence open the block, and under them a band of four support figures (median first reply, answered the first time, tickets this week, help articles) sits on shared hairlines, two by two on a phone and four across from lg. Below a second rule, seven questions run in a centred column, one answer open at a time. It's built from Accordion and Guides, with CSS transitions for the entrance and your theme's tokens for every colour. For support, help-desk and service pages that want to show how the team performs before they answer anything.

FAQ

How do I change the figures?

Edit STATS at the top of the file: each entry is a label and a value string. Two of them aren't typed. "Answered the first time" is worked out from WEEK (firstTime over handled) and "tickets handled this week" prints WEEK.handled, so the percentage can never disagree with the counts it comes from. Keep each label to a few words and give it a period ("this week", "each quarter") so the figure means something.

How do I change the questions?

Edit QUESTIONS: each entry is an id, the question and its answer, one to three sentences. OPEN_QUESTION names the one that's open on load; set it to an id that doesn't exist to start with all of them closed. 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. The Accordion takes hiddenUntilFound, so every closed answer stays in the markup as hidden="until-found": search engines see all seven, and the browser's find in page opens the answer that holds a match.

How are the figures marked up?

As a definition list: each figure is a dt (the label) and a dd (the value) in its own group, so a screen reader reads "median first reply, 4 min". The value is shown above its label with flex-col-reverse, which changes nothing in the reading order. Values sit in bdi, so a figure like "98%" or "4 min" keeps its order in a right-to-left page.

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 them all. 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.

How does it fit on a phone?

The title and sentence stay centred, the four figures go two by two on shared hairlines, and the questions follow in the same column, with the answers at a smaller size. A question that doesn't fit wraps to a second line, and nothing scrolls sideways at 320 pixels.

  • Pro

    Animated Counter FAQ

    Proof and freshness

    A side-header FAQ for an analytics tool: one large figure that counts up to this week's answered questions, the topics behind it, and seven questions in an accordion.

  • 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

    Avatars FAQ

    Proof and freshness

    An FAQ where every answer is signed: a stack of four initials avatars under the header and a named answerer at the foot of each answer.

  • Pro

    A results table of five customers with a before, an after and the change between them, whose column headers sort it, in a band between the rails: a split divider sets the quote of whoever is at the top of the table apart from the table, with + marks where it meets the band's rule.

  • Pro

    Hero With Stats

    Stats and live data

    A split hero with a headline, a Shine Button and a second action beside a rail of four key figures on shared hairlines, each with its period and a small bar trend.

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