Staaarter

Filterable Glossary

A jargon glossary whose letter filter is derived from the terms themselves, narrowing a two-column hairline definition list with an empty state and a suggest-a-term action.

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 button dependencies and any missing npm packages, and installs them straight into your project.

npx shadcn add https://staaarter.com/r/filterable-glossary.json

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

Usage

The file also exports faq89Demo, 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 { Faq89, faq89Demo } from "@/components/blocks/faq/faq89";

export default function Page() {
  return <Faq89 {...faq89Demo} />;
}

Props

PropTypeDefaultDescription
badgestringnoneSmall eyebrow label above the heading.
headingstringnoneSection heading.
descriptionstringnoneSection intro text.
termsGlossaryTerm[]noneGlossary entries; the letter filter and the definition list are both computed from this array.
suggestButtonLabelstring"Suggest a term"Label on the inert suggest-a-term button.
classNamestringnoneExtra classes for the outer section element.

Types

type GlossaryTerm = {
  term: string;
  definition: string;
};

Behavior notes

  • "use client" because clicking a letter pill actually filters the visible definitions via local state and a useMemo derivation, it isn't a static list of links.
  • The letter pills are not a hardcoded A-Z: they're computed from the terms prop as the full alphabetic range spanning the first letter through the last letter present in the glossary, so a letter inside that range with zero matching terms still gets a pill.
  • Clicking a letter with zero matching terms renders the empty state instead of an empty list; the demo data includes several such gap letters (e.g. D, F, N) between the range's first term (API key) and last term (Webhook).
  • "All" resets the filter back to the full term list.
  • "Suggest a term" is an inert button with no real submission handler.