Skip to content

FAQ with Category Tabs

Bootstrap 5 FAQ section where category pills switch between separate accordion sets, with question counts and a support card.

Live preview

Open in new tab

Code

A Bootstrap 5 FAQ section that groups questions by topic: category pills on the left switch between separate accordion sets on the right. It suits help centers, pricing pages and product landing pages where one long list of questions would be hard to scan. It needs no custom JavaScript, because Bootstrap's tab and collapse plugins do all the work.

How it works

The root section.fqt-faq uses a Bootstrap grid. The left column (col-lg-4) holds the heading, an intro line, the .fqt-pills tab list and a dark .fqt-contact card. Each .fqt-pill is a nav-link button with data-bs-toggle="pill" and a data-bs-target that points to a .tab-pane. Pills show an icon, the label and a .fqt-pill-count badge with the number of questions.

The right column contains .tab-content.fqt-content with one tab-pane per category (#fqt-pane-general, #fqt-pane-billing, #fqt-pane-account, #fqt-pane-shipping). Every pane wraps its own .accordion.fqt-accordion, and each .fqt-item uses data-bs-parent with that pane's accordion id, so only one answer per category is open at a time. The first question of every category starts expanded.

On phones the pills sit in a horizontally scrollable row; from the lg breakpoint flex-lg-column stacks them vertically as a sidebar and the support card appears. The accordion is restyled through Bootstrap's own --bs-accordion-* variables into separate rounded cards with an accent bar on the open question.

Customization

  • --fqt-accent and --fqt-accent-soft on .fqt-faq in style.css: change the teal used by the active pill, count badges and open question.
  • --fqt-bg and --fqt-card: set the section background and the card color of pills and questions.
  • --fqt-radius: make the question cards and the support card more or less rounded.
  • col-lg-4 and col-lg-8: change the column split, for example col-lg-3 and col-lg-9 for a narrower sidebar.
  • Remove data-bs-parent from the .accordion-collapse elements of a pane to let several answers stay open at once.
  • Add a category by copying one .fqt-pill and one .tab-pane, then giving both new matching ids.

Accessibility

The pill container has role="tablist" with an aria-label; each pill has role="tab", aria-controls and aria-selected, and each pane has role="tabpanel" with aria-labelledby. Bootstrap moves focus between tabs with the arrow keys and keeps only the active tab in the tab order. Accordion buttons expose aria-expanded and aria-controls. Questions use h3 headings under the section h2, focus rings use a high-contrast amber :focus-visible outline, and transitions are turned off with prefers-reduced-motion.

Usage notes

Requires the Bootstrap 5.3 bundle and Bootstrap Icons. Ids must be unique, so prefix them differently when you place two FAQ sections on the same page.

Requirements

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

  • <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css">
  • <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/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">
FAQ with Category Tabs – Bootstrap 5 faq sections component screenshot
FAQ with Category Tabs · Bootstrap 5 FAQ Sections

More FAQ Sections

Two-Column FAQ – Bootstrap 5 faq sections preview

Two-Column FAQ

Bootstrap 5 FAQ section with questions split into two accordion columns, plus/minus icons and a dark contact support prompt.

FAQ with Live Search Filter – Tailwind CSS faq sections preview

FAQ with Live Search Filter

Tailwind CSS FAQ section with a live search box that filters questions as you type, highlights matches, adds topic chips and shows an empty state.

FAQ Accordion Section – Tailwind CSS faq sections preview

FAQ Accordion Section

Dark Tailwind CSS FAQ section with an accessible accordion, smooth expand animation, keyboard navigation and a support contact card.