Live Search FAQ
An FAQ with a search field that narrows the list as it is typed, matching against topic, question, and answer, with every answer open on its own hairline row and an empty state when nothing matches.
Docs
Installation
A real shadcn registry command, not a copy-paste stand-in: it fetches this block plus its input, label dependencies and any missing npm packages, and installs them straight into your project.
npx shadcn add https://staaarter.com/r/live-search-faq.jsonPrefer not to use the CLI? Copy the source from the Code toggle above into src/components/blocks/faq/faq85.tsx instead.
Usage
The file also exports faq85Demo, 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 { Faq85, faq85Demo } from "@/components/blocks/faq/faq85"; export default function Page() { return <Faq85 {...faq85Demo} />; }
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. |
| searchPlaceholder | string | "Search questions..." | Placeholder text on the search input. |
| entries | FaqEntry[] | none | Full FAQ list; the search input filters this array by topic, question, and answer. |
| className | string | none | Extra classes for the outer section element. |
Types
type FaqEntry = { topic: string; question: string; answer: string; };
Behavior notes
- "use client" because the search input is a real controlled field: typing filters the visible entries via local state and a useMemo derivation, case-insensitively, across the topic, question, and answer fields.
- Every matching entry renders fully expanded on its own hairline row; there is no accordion collapse here, the search itself is the narrowing mechanism.
- An empty state message renders in place of the list when the query matches zero entries.
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.