Tabbed FAQ
Category-tabbed FAQ using a hand-built tab strip with an accordion per category.
Docs
Installation
A real shadcn registry command, not a copy-paste stand-in: it fetches this block plus its dependencies and any missing npm packages, and installs them straight into your project.
npx shadcn add https://staaarter.com/r/tabbed-faq.jsonPrefer not to use the CLI? Copy the source from the Code toggle above into src/components/blocks/faq/faq72.tsx instead.
Usage
The file also exports faq72Demo, the exact props behind the preview above. Spread it to get a working section in one line, then replace it with your own data.
import { Faq72, faq72Demo } from "@/components/blocks/faq/faq72"; export default function Page() { return <Faq72 {...faq72Demo} />; }
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| badge | string | none | Small eyebrow label above the heading. |
| heading | string | none | Centered section heading. |
| description | string | none | Centered supporting copy under the heading. |
| categories | Faq72Category[] | none | Tabbed categories, each holding its own list of questions and answers. |
| className | string | none | Extra classes for the outer section element. |
Types
type Faq72Item = { question: string; answer: string; }; type Faq72Category = { label: string; items: Faq72Item[]; };
Behavior notes
- "use client" because clicking a tab really switches the visible category, and each question is a real accordion trigger.
- This repo has no Tabs primitive, so the tab strip is hand-written as a row of toggle-style buttons with role="tablist"/role="tab" and aria-selected reflecting the active category.
- Switching tabs resets the accordion's open item back to closed for the newly selected category, which keeps the interaction simple and avoids stale open-index bugs across categories of different lengths.
- Only one question is open at a time within the active category's accordion.
More FAQ Blocks
View all →collapsible-accordion
Collapsible Accordion
Stacked cards with expandable sections, for full-length answers in a compact format.
open-list-layout
Open List Layout
Questions with answers displayed directly below in a simple always-open list.
three-column-grid
Three Column Grid
Q&A pairs arranged in a responsive grid layout, always open.
tabbed-categories
Tabbed Categories
Sidebar navigation with category tabs and an accordion of that category's questions.
searchable-accordion
Searchable Accordion
Search input that filters accordion items in real-time by question and answer text.
grouped-sections
Grouped Sections
FAQs organized into titled sections, each with its own independent accordion below it.