Tabbed Cards
A horizontal strip of category tabs, hand-written as buttons since this repo has no Tabs primitive. Clicking a tab swaps a grid of cards below to show that category's own set of questions and answers.
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-cards.jsonPrefer not to use the CLI? Copy the source from the Code toggle above into src/components/blocks/faq/faq20.tsx instead.
Usage
The file also exports faq20Demo, 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 { Faq20, faq20Demo } from "@/components/blocks/faq/faq20"; export default function Page() { return <Faq20 {...faq20Demo} />; }
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| heading | string | "Frequently asked questions" | Section heading. |
| description | string | "Browse answers by topic." | Supporting copy under the heading. |
| categories | FaqCategory[] | none | Ordered list of tab categories, each with its own FAQ items. |
| className | string | none | Extra classes for the outer section element. |
Types
interface FaqItem { question: string; answer: string; } interface FaqCategory { label: string; items: FaqItem[]; }
Behavior notes
- Real interactivity: clicking a tab updates local `useState` and swaps the visible card grid to that category's items.
- The first category is selected by default on mount.
- Tabs are plain buttons with `role="tab"` and `aria-selected`, not the shadcn Tabs primitive, since none exists in this component library.
- Client component, so the demo props live in a separate faq20.demo.tsx file to avoid the props being silently undefined in the live preview.
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.