Staaarter

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.

By Staaarter Team
FAQ
Docs
Live preview

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

Prefer 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

PropTypeDefaultDescription
headingstring"Frequently asked questions"Section heading.
descriptionstring"Browse answers by topic."Supporting copy under the heading.
categoriesFaqCategory[]noneOrdered list of tab categories, each with its own FAQ items.
classNamestringnoneExtra 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.