A dark Bootstrap 6 accordion where every item is a separate glass card with a colored icon tile, a title with a subtitle, and a small limit pill. The example lists the benefits of a travel insurance plan. The same pattern fits plan features, service lists, onboarding steps or support topics. It needs no JavaScript.
How it works
The list is .accordion.accordion-gap.awi-accordion. accordion-gap is a Bootstrap 6 modifier that turns the joined accordion into spaced, individually rounded cards. Each item is a native <details class="accordion-item awi-item"> with a shared name="awi-cover", so opening one benefit closes the others. The first item has open and shows expanded on load.
Inside each <summary class="accordion-header"> sit four parts in a flex row: the .awi-icon tile with a Bootstrap Icon, the .awi-text block (.awi-title and .awi-sub), the .awi-limit pill and the chevron svg.accordion-icon, which Bootstrap rotates when the item opens.
Colors come from one variable per item. Classes such as .awi-item--cyan or .awi-item--pink set --awi-tone. The icon tile, pill, check marks, open border and glow mix that tone with color-mix(). When an item opens, its icon tile fills with the solid tone, so the open item is easy to spot. The body is indented to line up with the title.
Bootstrap animates the opening through ::details-content and skips the animation for visitors who prefer reduced motion.
Customization
- Add a tone: create
.awi-item--violet { --awi-tone: #a78bfa; }and put the class on a<details>. --awi-bg,--awi-cardand--awi-card-openon.awi-root: change the page color and the closed and open card fills.--bs-accordion-gapon.awi-accordion: widens or tightens the space between cards (0.75rem here).--bs-accordion-border-radiuson.awi-accordion: makes the cards rounder or squarer.- Remove
name="awi-cover"from all items to let several cards stay open together. - Delete the
.awi-limitspan when you do not need a value on the right. The pill is hidden below 576 px anyway. - Swap any
bi-*icon class inside.awi-iconfor your own icon or an inline SVG.
Use cases
- Feature and plan overviews: colored icon tiles and subtitles introduce each section
- Pricing and limits pages: limit pills show quotas inside each accordion card
- Dark landing pages: spaced glass cards give the accordion a modern look
- Lightweight pages: native details elements work with no JavaScript
Accessibility
Each header is a native <summary>, so it is in the tab order, toggles with Enter or Space and reports its expanded state to screen readers with no ARIA. The icons and the chevron are aria-hidden, so the title and subtitle are read as the button name. Keyboard focus shows an outline in the item's tone. Muted text stays above WCAG AA contrast on the dark cards, and the card color transition turns off under prefers-reduced-motion.
Bootstrap 6 notes
Bootstrap 5 needed accordion-button, accordion-collapse and the Collapse plugin. Bootstrap 6 uses <details>/<summary> with accordion-header and accordion-body. A shared name replaces data-bs-parent, and the new accordion-gap modifier gives the spaced card layout. Custom colors go through --bs-accordion-* variables such as --bs-accordion-btn-bg and --bs-accordion-active-bg. data-bs-theme="dark" on the root keeps it dark in both color modes. Built on Bootstrap 6.0.0-alpha.1, so APIs may still change. Icons come from Bootstrap Icons.