FAQ section

FAQs as an accordion, a topic rail, or a searchable list that highlights matches.

npx shadcn@latest add @silicon-ui/faq-section
Loading…

Installation

With the shadcn CLI

npx shadcn@latest add @silicon-ui/faq-section

Manually

  1. Install the dependencies.

    npm install lucide-react motion
  2. Copy these files into your project. Shared files are skipped if you already have them.

    • components/silicon-ui/blocks/faq-section/faq-section.tsx
    • components/silicon-ui/blocks/faq-section/faq-section.module.css
    • components/silicon-ui/segmented-control/segmented-control.tsx shared
    • components/silicon-ui/segmented-control/segmented-control.module.css shared
    • components/silicon-ui/search-field/search-field.tsx shared
    • components/silicon-ui/search-field/search-field.module.css shared
  3. Install the foundation once per app for the design and motion tokens: npx shadcn@latest add @silicon-ui/silicon-foundation

Usage

Source codetsx
import { FaqSection } from "@/components/silicon-ui/blocks/faq-section/faq-section";

API reference

FaqSection

PropTypeDefault
variant

`accordion` is one centered list, `columns` groups questions beside a category rail, `search` filters as you type.

FaqSectionVariant

"search""columns""accordion"

"accordion"
titlestring"Frequently asked questions"
descriptionstring"Everything you need to know before you install your first component."
itemsFaqItem[]faqExampleItems
multiple

Allow several answers open at once. Defaults to false.

booleanfalse
value

Open item ids (controlled).

string[]—
defaultValue

Initially open item ids when uncontrolled.

string[]—
onValueChange(value: string[]) => void—
category

Active category in the columns variant (controlled).

string—
onCategoryChange(category: string) => void—
query

Search text in the search variant (controlled).

string—
onQueryChange(query: string) => void—
contact

A way to reach a person when the answer isn't here. Pass null to hide it.

{ label: string; description?: string; href?: string; onClick?: () => void } | null{ label: "Still have a question?", description: "Our team replies within a day." }
classNamestring—

Also accepts the props of HTMLAttributes.

FaqSectionBlock

PropTypeDefault
variantFaqSectionVariant

"search""columns""accordion"

"accordion"

Dependencies

npm
lucide-reactmotion
Registry
silicon-motion-tokenssearch-fieldsegmented-control