Skip to content

FAQ Accordion

Bootstrap 6 FAQ section with a native details accordion (first answer open, one at a time), a live question search and FAQPage schema markup.

Also known as: faq section, faq dropdown list, frequently asked questions, faq with search, faq schema markup

FAQ Accordion live demo

Open in new tab

Bootstrap 6 code (HTML, CSS, JS)

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-accent and --fqa-accent-soft on .fqa-root: change the eyebrow, open question, icon circles and search focus ring.
  • --fqa-bg, --fqa-ink and --fqa-line on .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 open attribute to another <details> to expand a different answer on load.
  • --bs-accordion-btn-icon-transform on .fqa-accordion: use rotate(180deg) with a chevron path for the classic look.
  • grid-template-columns on .fqa-wrap (992 px media query): changes the intro and list column ratio.
  • The heading uses the Fraunces Google Font: remove it from externalLibs to 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.

FAQ Accordion at a glance

Framework
Bootstrap 6
Code
HTML, CSS, JavaScript
JavaScript
Vanilla JavaScript, no jQuery
Dependencies
Bootstrap 6, Bootstrap Icons, fonts.googleapis.com
Layout
Responsive, works on mobile
Category
Accordions
License
Free for personal and commercial use

Questions about this template

Can I use the FAQ Accordion code for free?

Yes. You can copy or download the code and use it in personal and commercial projects, including client work. No sign-up is needed. Reselling it as part of a component library or template collection is not allowed; see the license.

How do I add it to my website?

Load Bootstrap 6 and Bootstrap Icons and fonts.googleapis.com from a CDN (the links are under Requirements). Paste the HTML where the component should appear, add the CSS to your stylesheet and load the JavaScript before the closing </body> tag. Download HTML gives you a complete page with everything already linked.

Does it need jQuery or a JavaScript framework?

No. The script is plain vanilla JavaScript, so it works without jQuery, React or Vue. You can still use the markup inside those frameworks.

Does it work on mobile?

Yes. The layout adapts to small screens. Use the Mobile and Tablet buttons above the live demo to check it at phone and tablet width.

Requirements

Add these to your page (already included in the download):

  • <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@6.0.0-alpha.1/dist/css/bootstrap.min.css">
  • <script type="module" src="https://cdn.jsdelivr.net/npm/bootstrap@6.0.0-alpha.1/dist/js/bootstrap.bundle.min.js"></script>
  • <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css">
  • <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,600&display=swap">

Built for Bootstrap 6.0.0-alpha.1. Bootstrap 6 ships as an ES module, so its script and this component's JavaScript load with type="module". Alpha releases can still change before the stable version.

FAQ Accordion – free Bootstrap 6 accordion template
FAQ Accordion · free Bootstrap 6 accordion template

More Accordions

Horizontal Image Accordion – free Pure CSS accordion template

Horizontal Image Accordion

Row of five photo panels that expand horizontally on hover, focus or tap, with vertical titles, smooth @property transitions and a stacked mobile layout.

Accordion with Icons – free Bootstrap 6 accordion template

Accordion with Icons

Dark Bootstrap 6 accordion with spaced glass cards, colored leading icon tiles, subtitles and limit pills, built on native details with no JavaScript.

Accordion with details and summary – free Pure CSS accordion template

Accordion with details and summary

No-JavaScript FAQ accordion built on native details and summary elements with smooth height animation and one-open-at-a-time behavior.

Accordion with Icons – free Bootstrap 5 accordion template

Accordion with Icons

Bootstrap 5 FAQ accordion with leading icon tiles, subtitles, rounded cards, a rotating plus icon and a warm accent color.

Plus/Minus Accordion – free Tailwind CSS accordion template

Plus/Minus Accordion

Tailwind CSS accordion with a rotating plus/minus icon, smooth height animation, keyboard navigation and a switch for single-open or multi-open mode.