Staaarter

Tabbed Categories

A left sidebar of category buttons with active-state styling, paired with a right-hand accordion that swaps to the selected category's questions. Good for FAQ pages with enough content to warrant grouping by topic.

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

Prefer not to use the CLI? Copy the source from the Code toggle above into src/components/blocks/faq/faq10.tsx instead.

Usage

The file also exports faq10Demo, 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 { Faq10, faq10Demo } from "@/components/blocks/faq/faq10";

export default function Page() {
  return <Faq10 {...faq10Demo} />;
}

Props

PropTypeDefaultDescription
headingstring"Frequently asked questions"Section heading.
descriptionstringundefinedOptional supporting copy under the heading.
categoriesFaq10Category[]noneOrdered list of category tabs, each with its own list of question and answer entries.
classNamestringnoneExtra classes for the outer section element.

Types

type Faq10Item = { question: string; answer: string };

type Faq10Category = {
  label: string;
  items: Faq10Item[];
};

Behavior notes

  • Real interactivity: clicking a sidebar category button switches the active category in state, which swaps the entire accordion list on the right.
  • The accordion on the right has its own open/close state per item, single-open-at-a-time; switching categories resets it to fully collapsed rather than trying to preserve which index was open.
  • The sidebar becomes a horizontally scrolling row below the lg breakpoint and a vertical stack above it.
  • The first category is active and its accordion starts fully collapsed on initial render.