Skip to content

Faq Section

An FAQ section with a heading column and an accessible accordion: one answer open at a time, arrow key navigation, aria-expanded and smooth row animation.

src/registry/blocks/faq-section.tsx/r/faq-section.json

Installation

bash
npx shadcn@latest add @minidev/faq-section

MiniDev UI is in the shadcn registry directory, so the short form works with no setup. Older CLI versions can use the full URL: npx shadcn@latest add https://ui.minidev.pro/r/faq-section.json

Usage

tsx
import { FaqSection } from "@/components/ui/faq-section"

export function Example() {
  return (
    <FaqSection />
  )
}

API reference

FaqSection props
PropTypeDefault
eyebrowSmall mono label above the title. Empty string hides it.string"FAQ"
titleSection heading (rendered as h2).React.ReactNode"Questions, answered."
descriptionLine under the heading, e.g. how to reach a person.React.ReactNode"Something else on your mind? Write t...
itemsQuestions in order. Defaults to Lumen's FAQ.Faq[]ITEMS
defaultOpenIndex of the question open on first render; `null` starts all closed.number | null0
classNamestring-

When to use

Use near the end of a marketing page, before the closing CTA. Answers open by animating grid rows (no measuring) and the plus turns into a cross. Keyboard follows the WAI-ARIA accordion pattern: Enter/Space toggles, Arrow Up/Down move between questions, Home/End jump to the first/last. Closed answers are inert. For an in-app collapsible list use Accordion.

Keyboard interactions

Keyboard interactions
KeyAction
EnterorSpaceOpens or closes the focused question.
ArrowDownorArrowUpMoves focus to the next or previous question, wrapping at the ends.
HomeorEndMoves focus to the first or last question.
TabMoves to the next question, or into links in the open answer.

Accessibility

  • The section is labelled by its <h2>; each question is a <button> inside an <h3> with aria-expanded and aria-controls.
  • Each answer is a role="region" labelled by its question and is inert while closed.
  • The plus icon is aria-hidden. Its turn and the answer's height and fade transitions are switched off with motion-reduce:transition-none.

Frequently asked questions

Are closed answers still in the HTML for search engines?

Yes. Every answer is rendered and collapsed with a grid-template-rows transition, and closed ones are inert, so the text is in the server HTML but cannot be focused. Add FAQPage JSON-LD yourself if you want rich results; the block does not emit it.

Can an answer contain links?

Yes, a takes any React node. Links in a closed answer are skipped by Tab because the panel is inert, and they become reachable when it opens.

How do I start with all questions closed?

Pass defaultOpen={null}. The default is 0, which opens the first question. Only one question is open at a time.

Dependencies

npm

lucide-react

Built from

No other MiniDev files
All Landing page sections for React and Tailwind

Learn more