Skip to content

Flush Accordion

Bootstrap 6 flush accordion for a course syllabus with an Always open switch that toggles between multi-open and one-at-a-time, plus Expand all and Collapse all.

Also known as: collapsible syllabus list, course syllabus accordion, expand all collapse all, multi open accordion, borderless accordion

Flush Accordion live demo

Open in new tab

Bootstrap 6 code (HTML, CSS, JS)

A course syllabus built with the Bootstrap 6 flush accordion: no outer border, only hairlines between the modules, so it sits cleanly inside a card. An "Always open" switch lets visitors choose between keeping several modules open and seeing one at a time. Expand all and Collapse all buttons sit next to it.

How it works

The list is .accordion.accordion-flush.fla-accordion, and each module is a native <details class="accordion-item"> with a <summary class="accordion-header">. The summary holds the module number .fla-num, the .fla-title, the .fla-meta lesson count and the chevron svg.accordion-icon. The body is an ordered .fla-lessons list. A CSS counter numbers the lessons, and each row ends with a monospaced .fla-time.

Bootstrap 6 makes <details> items exclusive when they share a name. script.js uses that for the mode switch:

  • Always open (switch on): applyMode() removes name from every item, so any number of modules can stay open. This is the starting state, with modules 01 and 02 open.
  • One at a time (switch off): the script keeps only the first open module open, then gives every item the same generated name (fla-group-1, fla-group-2, … per instance). From then on the browser closes the previous module when a new one opens.

Expand all sets open on every item and only works in always-open mode. Collapse all closes everything in both modes. A toggle listener on each <details> runs syncButtons(), which disables a button when it has nothing to do and moves keyboard focus to the other button if needed. Without JavaScript all modules can stay open.

Customization

  • --fla-accent on .fla-root: recolors the kicker, the open module number, the switch and the focus rings.
  • --fla-paper, --fla-card and --fla-line on .fla-root: change the ruled page background, the card and the dividers.
  • Uncheck #fla-always in the HTML (remove checked) to start in one-at-a-time mode.
  • Add or remove open on a <details> to choose which modules are expanded on load.
  • --bs-accordion-padding-x and --bs-accordion-padding-y on .fla-accordion: make the rows roomier or tighter.
  • Delete .fla-bulk if you only need the switch: the script skips the bulk buttons when they are missing.

Use cases

  • Course and training pages: a syllabus lists modules that expand to show lessons
  • Documentation and policies: an Always open switch toggles between multi-open and one-at-a-time
  • Long content pages: Expand all and Collapse all buttons open or close every section
  • Clean layouts: the flush style removes outer borders to blend into the page

Accessibility

Each header is a native <summary>, so it is focusable, toggles with Enter or Space and reports its state without ARIA. The switch uses role="switch" with a visible label and a visually hidden description that explains the mode. The bulk buttons sit in a labelled btn-group, and disabled buttons hand focus to their partner. Decorative numbers and chevrons are aria-hidden. Focus rings use the accent color, and Bootstrap skips the height animation under prefers-reduced-motion.

Bootstrap 6 notes

accordion-flush still exists, but the Bootstrap 5 Collapse markup (accordion-button, accordion-collapse, data-bs-parent) is gone. Items are <details>, and "always open" now simply means no shared name. The switch is the new .switch wrapper with a native switch attribute instead of form-switch, and the buttons are btn-outline theme-secondary. Built on Bootstrap 6.0.0-alpha.1, so APIs may still change.

Flush Accordion at a glance

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

Questions about this template

Can I use the Flush 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 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>

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.

Flush Accordion – free Bootstrap 6 accordion template
Flush 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.

FAQ Accordion – free Bootstrap 6 accordion template

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.

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.