Accordion FAQ in React
Questions that expand one by one, with FAQPage structured data for Google.
Here is an excerpt of this component's code in React. The full code is free for members, ready to copy into your project.
This component also comes in
The code in React
export function AccordionFaq() {
return (
<div className="mx-auto w-[min(100%_-_2rem,46rem)] py-8">
<section>
<h2 className="mb-6 text-3xl font-bold">Questions fréquentes</h2>
<details className="group border-b border-slate-200 dark:border-slate-800">
<summary className="flex cursor-pointer list-none items-center justify-between gap-4 py-4.5 text-lg font-semibold focus-visible:outline-3 focus-visible:outline-offset-2 focus-visible:outline-blue-700 dark:focus-visible:outline-blue-300 [&::-webkit-details-marker]:hidden">
Intervenez-vous le week-end ?
<span className="grid size-8 shrink-0 place-items-center rounded-full bg-white text-blue-700 transition-transform group-open:rotate-45 motion-reduce:transition-none dark:bg-slate-900 dark:text-blue-300">
<svg
className="size-3.5"
viewBox="0 0 16 16"Free component: copy it freely, including for commercial projects.
Other FAQ and accordions components in React
FAQ and accordions components in React
A native accordion FAQ where each answer asks “Was this answer helpful?”, with a thank-you message and a remembered vote.
- Tailwind
- React
- CSS
- WordPress

Two-column FAQ
FreeAn introduction and a contact link on the left, expandable questions on the right.
- Tailwind
- React
- CSS
- WordPress

A tight accordion within a single frame, for practical information pages.
- Tailwind
- React
- CSS
- WordPress

FAQ by category
FreeQuestions grouped under subheadings, for long FAQs.
- Tailwind
- React
- CSS
- WordPress

Open card FAQ
FreeAll answers visible at once, presented as a card grid.
- Tailwind
- React
- CSS
- WordPress

Frequently asked questions followed by a card inviting visitors to call or write.
- Tailwind
- React
- CSS
- WordPress