FAQ
Accordion-style FAQ built on native details and summary.
Preview
Answers ease open instead of snapping; still native details, so it works without JavaScript. With reduced motion turned on, it renders the plain layout.
Frequently asked questions
Is it free?
Yes. MIT licensed, for personal and commercial projects.
Do I need to install a package?
No. The shadcn CLI copies the component into your project.
Does it work with my theme?
Yes. It uses your shadcn theme variables.
Frequently asked questions
Is it free?
Yes. MIT licensed, for personal and commercial projects.
Do I need to install a package?
No. The shadcn CLI copies the component into your project.
Does it work with my theme?
Yes. It uses your shadcn theme variables.
Installation
Run this in a project that already uses shadcn/ui. It adds the component and anything it needs; the motion version also adds the plain one and the motion package.
Usage
import { Faq } from "@/components/custom/faq";
<Faq
items={[
{ question: "Is it free?", answer: "Yes, MIT licensed." },
{ question: "Do I need a package?", answer: "No, the code is yours." },
]}
/>import { FaqMotion } from "@/components/custom/faq/faq-motion";
<FaqMotion {...props} />Props
| Prop | Type | Default | Description |
|---|---|---|---|
| items* (required) | { question: string; answer: string }[] | – | Questions and answers, in order. |
| title | string | "Frequently asked questions" | Heading above the list. |
| ...props | React.ComponentProps<"section"> | – | Any other section attribute (id, aria-*, data-*, ref) goes to the root element. |
| Prop | Type | Default | Description |
|---|---|---|---|
| items* (required) | { question: string; answer: string }[] | – | Questions and answers, in order. |
| title | string | "Frequently asked questions" | Heading above the list. |
| ...props | React.ComponentProps<"section"> | – | Any other section attribute (id, aria-*, data-*, ref) goes to the root element. |
Accessibility
- Built on native <details> and <summary>: keyboard and screen-reader support come from the browser, with no JavaScript.
- The motion version follows the visitor's reduced-motion setting and never hides content before it animates.