Block 17 of 297
FAQ Accordion
Questions that expand in place on native <details>. No JavaScript, fully keyboard accessible.
- Puck key
- FaqAccordionBlock
- Export
- faqAccordionBlock
- React component
- <FaqAccordion />
- Path
- components/puck/faq-accordion-block.tsx
- Dependencies
- None
- License
- MIT
About this block
When to use it, how to write for it, and what to change in the code.
What it's for
Questions that open in place to show their answers, with the heading, intro and an optional help link in a narrow column beside the list on desktop. It uses the browser's native details element, so it works without JavaScript. On phones the heading sits above the questions. The first question can start open.
- Registration, refund and eligibility questions on a program page
- Common questions before someone donates or applies
- A support or visitor information page
Writing the content
- Write each Question the way people ask it, and lead the Answer with the direct answer.
- Keep to the ten or so questions people really ask; the block allows up to twenty.
- Separate paragraphs in an Answer with a blank line.
- Use Help link text to point to a contact page for questions the list doesn't cover; blank hides it.
Accessibility
- Each item is a native details and summary pair, so it opens with Enter or Space and announces its expanded state without custom ARIA (WCAG 2.1.1, 4.1.2).
- Summaries show an indigo focus outline and are at least 44px tall.
- The plus icon is aria-hidden, and its turn into an x is visual only; the open or closed state is exposed by the details element itself.
Customizing the code
- The open-state icon uses group-open:bg-indigo-600; change it with the link colors.
- The side column split is lg:col-span-4 and lg:col-span-8; change both for a wider heading column.
Editor fields
What content editors see in the P1 sidebar when they select this block.
- Headingtext
- Heading levelselect
- Introtextarea
- Questionsarray
- First questionradio
- Help link texttext
- Help linktext