A list group is a vertical stack of items with a border around the whole block: a sidebar menu, a folder list, a set of filters with counts. This example builds a linked list group with an icon and a count badge on each item, the classic “Pictures 100, Documents 38” layout.
Page setup
Bootstrap 4 dropped the Glyphicons icon font that Bootstrap 3 shipped with. The official replacement is Bootstrap Icons, a separate package. Load both stylesheets:
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
<link href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css" rel="stylesheet">
The list group itself needs no JavaScript.
The list group
<div class="list-group">
<a href="/pictures/" class="list-group-item list-group-item-action d-flex justify-content-between align-items-center active" aria-current="true">
<span><i class="bi bi-camera me-2" aria-hidden="true"></i>Pictures</span>
<span class="badge text-bg-light rounded-pill">100 <span class="visually-hidden">items</span></span>
</a>
<a href="/documents/" class="list-group-item list-group-item-action d-flex justify-content-between align-items-center">
<span><i class="bi bi-file-earmark me-2" aria-hidden="true"></i>Documents</span>
<span class="badge text-bg-primary rounded-pill">38 <span class="visually-hidden">items</span></span>
</a>
<a href="/music/" class="list-group-item list-group-item-action d-flex justify-content-between align-items-center">
<span><i class="bi bi-music-note-beamed me-2" aria-hidden="true"></i>Music</span>
<span class="badge text-bg-primary rounded-pill">121 <span class="visually-hidden">items</span></span>
</a>
<a href="/videos/" class="list-group-item list-group-item-action d-flex justify-content-between align-items-center">
<span><i class="bi bi-film me-2" aria-hidden="true"></i>Videos</span>
<span class="badge text-bg-primary rounded-pill">9 <span class="visually-hidden">items</span></span>
</a>
</div>
What changed from Bootstrap 3
.list-group-item-action. In Bootstrap 3 any <a class="list-group-item"> got a hover effect. Now you add .list-group-item-action to links and buttons to get the hover, focus and pressed styles. Leave it off for items that are not interactive.
Badges no longer float right. Bootstrap 3 pushed a .badge inside a list group item to the right automatically. In version 5 you lay that out yourself with flex utilities: d-flex justify-content-between align-items-center on the item, and exactly two children, the label on the left and the badge on the right. That is why the icon and text are wrapped in one <span>.
Badge colors. Badges are no longer gray by default. Pick a color with the text-bg-* helpers (added in 5.2), which set a background and a readable text color together. The active item has a primary blue background, so its badge uses text-bg-light to stay visible.
Icons. <span class="glyphicon glyphicon-camera"> becomes <i class="bi bi-camera">. Bootstrap Icons has an icon for most former Glyphicons, though the names differ; search the icon list for the one you need.
Accessibility details
The active item carries aria-current="true" so screen readers announce it as the current one, not just as a link that happens to be blue. If the list is the site navigation and the item is the page being viewed, use aria-current="page" instead.
The icons are decorative: the text next to them already says what the item is. aria-hidden="true" keeps screen readers from trying to read them. A bare number in a badge is easy to misread when heard out of context, so the visually hidden “items” turns “Pictures 100” into “Pictures 100 items”.
To disable an item, add .disabled and aria-disabled="true" to a link, or use a <button type="button"> with the disabled attribute. Buttons are also the right element when an item runs a script rather than opening a page.
Other variations
.list-group-flushremoves the outer borders and rounded corners so the items run edge to edge, for example inside a card..list-group-numberedon an<ol class="list-group">adds numbers to the items (from 5.1)..list-group-horizontallays the items out in a row, with breakpoint variants such as.list-group-horizontal-md..list-group-item-success,.list-group-item-dangerand the other variants color a single item.
A list group can also switch tab panes with data-bs-toggle="list" (the Bootstrap 3 attribute was data-toggle). That does need the JavaScript bundle; see the tab menu example below for the pattern.