# 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.

- Kind: Block (Landing pages)
- Docs: https://ui.minidev.pro/docs/faq-section
- Source (registry JSON with the full file): https://ui.minidev.pro/r/faq-section.json
- License: MIT. One file, yours to edit after install.

## 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.

## Installation

### shadcn CLI (copies the source into your project)

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

Writes `components/ui/faq-section.tsx` and installs its npm dependencies. Older CLI versions: `npx shadcn@latest add https://ui.minidev.pro/r/faq-section.json`.

### npm package

```bash
npm i minidev-ui-kit lucide-react
```

Add the tokens to your global stylesheet once:

```css
@import "tailwindcss";
@import "minidev-ui-kit/styles.css";
@source "../node_modules/minidev-ui-kit";
```

Next.js also needs `transpilePackages: ["minidev-ui-kit"]` in next.config.

## Import

After the shadcn install:

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

From the npm package:

```tsx
import { FaqSection } from "minidev-ui-kit/blocks/faq-section"
```

## Usage

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

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

## Props

| Prop | Type | Default | Required | Description |
| --- | --- | --- | --- | --- |
| `eyebrow` | `string` | `"FAQ"` | no | Small mono label above the title. Empty string hides it. |
| `title` | `React.ReactNode` | `"Questions, answered."` | no | Section heading (rendered as h2). |
| `description` | `React.ReactNode` | `"Something else on your mind? Write t...` | no | Line under the heading, e.g. how to reach a person. |
| `items` | `Faq[]` | `ITEMS` | no | Questions in order. Defaults to Lumen's FAQ. |
| `defaultOpen` | `number \| null` | `0` | no | Index of the question open on first render; `null` starts all closed. |
| `className` | `string` | - | no |  |

## Keyboard interactions

| Key | Action |
| --- | --- |
| `Enter` or `Space` | Opens or closes the focused question. |
| `ArrowDown` or `ArrowUp` | Moves focus to the next or previous question, wrapping at the ends. |
| `Home` or `End` | Moves focus to the first or last question. |
| `Tab` | Moves 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`.

## FAQ

### 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.

## Rules for generating code

- Use semantic tokens only (bg, surface, sunken, border, fg, fg-muted, fg-subtle, ink, accent, success, warning, danger). Never raw hex or palette steps like blue-500.
- Shadows only from the set: shadow-xs, shadow-sm, shadow-raised, shadow-md, shadow-lg, shadow-overlay.
- Numbers use tabular-nums. Dark mode is the `dark` class on <html>; components never branch on theme.

## Dependencies

- npm: `lucide-react`

## Related

- [Accordion](https://ui.minidev.pro/docs/accordion/md): Accessible React accordion on Base UI, with bordered items, a rotating chevron and animated panels. Keyboard navigable, with one or many items open at once.
- [Marketing Landing](https://ui.minidev.pro/docs/marketing-landing/md): A complete Tailwind landing page assembled from a hero with two actions, a logo cloud, a stats strip, a three column feature grid and a closing CTA banner.
- [Bento Live](https://ui.minidev.pro/docs/bento-live/md): A React bento feature grid where each tile runs a live demo: a rolling MRR counter, a typed AI answer, ranked alerts and an orbiting integrations ring.
- [Changelog Page](https://ui.minidev.pro/docs/changelog-page/md): A Tailwind changelog card listing releases with a monospace version, tag badge, date, title and summary, separated by hairline dividers.
- [Cta Band](https://ui.minidev.pro/docs/cta-band/md): A closing CTA section with a large lit headline and an inline email form whose button animates from idle to sending to a success check. Async onSubmit.
- [Hero Spotlight](https://ui.minidev.pro/docs/hero-spotlight/md): A launch hero with a pulsing eyebrow, blur-in headline with a cursor lit second line, two actions, a proof line and a product visual that tilts into place.

---

All 557 components: https://ui.minidev.pro/llms.txt (full text: https://ui.minidev.pro/llms-full.txt).
