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.
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.jsonPrefer 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
| Prop | Type | Default | Description |
|---|---|---|---|
| badge | string | none | Small eyebrow label above the heading. |
| heading | string | none | Section heading. |
| description | string | none | Section intro text. |
| terms | GlossaryTerm[] | none | Glossary entries; the letter filter and the definition list are both computed from this array. |
| suggestButtonLabel | string | "Suggest a term" | Label on the inert suggest-a-term button. |
| className | string | none | Extra 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.
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.