A two-column FAQ section built on the Bootstrap 6 accordion. The first answer is open on load, only one answer stays open at a time, and a search box filters the questions as you type. A dark contact card points visitors to support when the list does not help. Drop it into a help center, pricing page or landing page footer.
How it works
The accordion is plain HTML: .fqa-accordion holds <details class="accordion-item"> elements, each with a <summary class="accordion-header"> and an .accordion-body. All items share name="fqa-faq", so the browser closes the open item when another one opens. The first item has the open attribute, so it shows expanded with no script. Bootstrap 6 animates the height through ::details-content and turns the animation off under reduced motion.
The icon is an inline SVG plus with the accordion-icon class. Setting --bs-accordion-btn-icon-transform: rotate(45deg) turns it into a close cross when the item opens, and the open icon fills with the accent color.
script.js only adds the filter. On every input event on .fqa-filter it hides items whose text does not contain the query. If the open item is filtered out, it opens the first match. It writes the number of matches, or a no-results message, into .fqa-empty. When nothing matches, .fqa-root--no-results hides the list. Without JavaScript the accordion still works and the search box does nothing.
Each question carries schema.org FAQPage, Question and Answer microdata, so search engines can read the questions and answers.
Customization
--fqa-accentand--fqa-accent-softon.fqa-root: change the eyebrow, open question, icon circles and search focus ring.--fqa-bg,--fqa-inkand--fqa-lineon.fqa-root: change the page tint, text and contact card color, and the dividers.- Remove
name="fqa-faq"from the items to let several answers stay open together. - Move the
openattribute to another<details>to expand a different answer on load. --bs-accordion-btn-icon-transformon.fqa-accordion: userotate(180deg)with a chevron path for the classic look.grid-template-columnson.fqa-wrap(992 px media query): changes the intro and list column ratio.- The heading uses the Fraunces Google Font: remove it from
externalLibsto fall back to Georgia.
Use cases
- Product and pricing pages: a native details accordion answers common questions, one at a time
- Help centers: a live question search filters the list as visitors type
- SEO-minded sites: FAQPage schema markup describes the questions for search engines
- Support pages: the first answer opens by default so visitors see the format right away
Accessibility
<summary> elements are native disclosure buttons: they are focusable, open with Enter or Space and expose their expanded state without ARIA. The icons are aria-hidden. The search field has an aria-label and aria-controls, and the result count is announced through a role="status" live region. Focus outlines use the accent color, and the text colors meet WCAG AA on their backgrounds.
Bootstrap 6 notes
Bootstrap 5's accordion-button, accordion-collapse and data-bs-parent are gone. Bootstrap 6 builds the accordion on <details>/<summary>, and a shared name replaces data-bs-parent. The search field uses the new form-adorn and form-ghost classes. The root sets data-bs-theme="light". Built on Bootstrap 6.0.0-alpha.1, so APIs may still change. Icons come from Bootstrap Icons.