FAQ Accordion with Plus/Minus Icons
A single-column FAQ accordion under a centered heading. Each question shows a plus icon that cross-fades into a minus icon the moment it's opened, and back again when it's closed, and only one answer is visible at a time.
Docs
Installation
A real shadcn registry command, not a copy-paste stand-in: it fetches this block plus its dependencies and any missing npm packages, and installs them straight into your project.
npx shadcn add https://staaarter.com/r/faq-accordion-plus-minus.jsonPrefer not to use the CLI? Copy the source from the Code toggle above into src/components/blocks/feature/feature120.tsx instead.
Usage
The file also exports feature120Demo, 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 { Feature120, feature120Demo } from "@/components/blocks/feature/feature120"; export default function Page() { return <Feature120 {...feature120Demo} />; }
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| eyebrow | string | undefined | Small label above the heading; omitted entirely when unset. |
| heading | ReactNode | none | Section heading. |
| description | string | undefined | Supporting copy under the heading. |
| items | Feature120FaqItem[] | none | FAQ entries; all collapsed by default. |
| className | string | undefined | Extra classes for the outer section element. |
Types
interface Feature120FaqItem { question: string; answer: string; }
Behavior notes
- Real client-side state: `openIndex` (number | null) tracks a single open question via useState, starting at null so every item is collapsed on mount.
- Implements single-open mode as the real default: opening a question closes whichever one was previously open, and clicking the open question again collapses it. A multi-open variant (each item tracked with its own boolean instead of one shared index, so several answers can stay open at once) is a straightforward variant of the same pattern but is not built here.
- The plus/minus icon swap is a real state-driven cross-fade (two absolutely-stacked icons, opacity/scale toggled by `isOpen`), not a CSS-only rotate trick, so it's driven by the same state as the accordion panel.
- "use client" component, so its demo props live in the sibling feature120.demo.tsx file per this repo's client/demo-file-split rule, not in feature120.tsx itself.
- aria-expanded and aria-controls wire each question button to its answer panel for screen readers; the plus/minus icon pair is aria-hidden since the button's aria-expanded state already conveys open/closed.
More Feature Blocks
View all →Full-Bleed Workspace Band
Two-column header above a full-bleed image band with a live view switcher, closing on three numbered captions.
Center-Line Journey Timeline
Vertical hairline timeline alternating stages either side, dropping a phone frame on one step.
Figure-Led Evidence Rows
Tall image with a floating before-and-after card, leading into oversized-figure evidence rows.
Staircase Asset Trio
Three image tiles stepping down the page in a staircase, each floating a different live asset.
Sticky Reference List
Sticky heading column beside three labelled groups of checked capabilities, closing on a footnote.
Day Timeline Rows
Hairline rows walking through one working day, stamped with time and a live approval card inline.