Bootstrap Menus: 16 Examples Beyond the Navbar

Search the Bootstrap 5.3 docs for a component called menu and you won't find one. The Bootstrap 6 alpha, released October 8, 2026, renames Dropdown to Menu, but 5.3.8 is still the stable release for production work.

Below are 16 Bootstrap menu examples you can copy, from restaurant menus to context menus, followed by a guide to building and fixing them.

By Bogdan Sandu ยท Updated October 29, 2026

Every example runs on Bootstrap 5.3.8 from the jsDelivr CDN. Add these tags to your page, then paste an example's HTML, CSS and JS.

<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.8/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-sRIl4kxILFvY47J16cr9ZwB07vP4J8+LH7qKQnuqkuIAvNWLzeN8tE5YBujZqJLB" crossorigin="anonymous">
<link href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.13.2/font/bootstrap-icons.min.css" rel="stylesheet" integrity="sha384-nWN3KqaaVcbEsCjLSV+2jMjh62Iny/+mN3srM8TZeM8N6aj7eDl5wwYggjAJ4/sJ" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.8/dist/js/bootstrap.bundle.min.js" integrity="sha384-FKyoEForCGlyvwx9Hj09JcYn3nv7wiPVlz7YYwJrWVcXK/BmnVDxM+D2scQbITxI" crossorigin="anonymous"></script>

Restaurant and cafe menus

A "menu" in the food sense, built from Bootstrap parts: tabs per course, flush list groups, dotted price leaders, dietary badges and a pairing switch. Each one is a real card you can drop into a restaurant site.

Bistro dinner menu with a tab per course

  • nav-underline
  • tab-pane fade
  • --bs-nav-underline-*
  • visually-hidden

Switch courses, filters or the pairing toggle.

Starters, mains and desserts are panes driven by the Tab plugin on a nav-underline strip, so arrow keys move between courses. Each dish is a flex row with a dotted leader that stretches between the name and the price, and the dietary codes are badges with visually-hidden full words for screen readers.

View code
<div class="bmn-bistro w-100 border rounded-4 shadow-sm overflow-hidden">
  <div class="text-center px-3 pt-4 pb-3">
    <h3 class="bmn-serif mb-1">Maison Ardoise</h3>
    <p class="small bmn-bistro-muted mb-0">Dinner, served 6 to 10 pm</p>
  </div>
  <ul class="nav nav-underline justify-content-center gap-4 border-bottom px-3 bmn-bistro-tabs" role="tablist">
    <li class="nav-item" role="presentation"><button class="nav-link active" id="bmn-tab-start" data-bs-toggle="tab" data-bs-target="#bmn-pane-start" type="button" role="tab" aria-controls="bmn-pane-start" aria-selected="true">Starters</button></li>
    <li class="nav-item" role="presentation"><button class="nav-link" id="bmn-tab-main" data-bs-toggle="tab" data-bs-target="#bmn-pane-main" type="button" role="tab" aria-controls="bmn-pane-main" aria-selected="false">Mains</button></li>
    <li class="nav-item" role="presentation"><button class="nav-link" id="bmn-tab-sweet" data-bs-toggle="tab" data-bs-target="#bmn-pane-sweet" type="button" role="tab" aria-controls="bmn-pane-sweet" aria-selected="false">Desserts</button></li>
  </ul>
  <div class="tab-content px-3 px-sm-4 py-3">
    <div class="tab-pane fade show active" id="bmn-pane-start" role="tabpanel" aria-labelledby="bmn-tab-start" tabindex="0">
      <ul class="list-unstyled mb-0">
        <li class="bmn-dish">
          <p class="bmn-dish-line mb-0"><span class="bmn-dish-name">French onion soup</span><span class="bmn-leader" aria-hidden="true"></span><span class="bmn-price">$11</span></p>
          <p class="small bmn-bistro-muted mb-0">Gruyere crouton, thyme, slow-cooked onions <span class="badge rounded-pill bmn-diet"><span aria-hidden="true">V</span><span class="visually-hidden">Vegetarian</span></span></p>
        </li>
        <li class="bmn-dish">
          <p class="bmn-dish-line mb-0"><span class="bmn-dish-name">Beetroot tartare</span><span class="bmn-leader" aria-hidden="true"></span><span class="bmn-price">$13</span></p>
          <p class="small bmn-bistro-muted mb-0">Smoked almond, dill, rye crisp <span class="badge rounded-pill bmn-diet"><span aria-hidden="true">VG</span><span class="visually-hidden">Vegan</span></span></p>
        </li>
        <li class="bmn-dish">
          <p class="bmn-dish-line mb-0"><span class="bmn-dish-name">Moules marinieres</span><span class="bmn-leader" aria-hidden="true"></span><span class="bmn-price">$16</span></p>
          <p class="small bmn-bistro-muted mb-0">White wine, shallot, parsley <span class="badge rounded-pill bmn-diet"><span aria-hidden="true">GF</span><span class="visually-hidden">Gluten free</span></span></p>
        </li>
      </ul>
    </div>
    <div class="tab-pane fade" id="bmn-pane-main" role="tabpanel" aria-labelledby="bmn-tab-main" tabindex="0">
      <ul class="list-unstyled mb-0">
        <li class="bmn-dish">
          <p class="bmn-dish-line mb-0"><span class="bmn-dish-name">Steak frites</span><span class="bmn-leader" aria-hidden="true"></span><span class="bmn-price">$34</span></p>
          <p class="small bmn-bistro-muted mb-0">Hanger steak, bearnaise, hand-cut fries <span class="badge rounded-pill bmn-diet"><span aria-hidden="true">GF</span><span class="visually-hidden">Gluten free</span></span></p>
        </li>
        <li class="bmn-dish">
          <p class="bmn-dish-line mb-0"><span class="bmn-dish-name">Duck confit</span><span class="bmn-leader" aria-hidden="true"></span><span class="bmn-price">$31</span></p>
          <p class="small bmn-bistro-muted mb-0">Puy lentils, cherry jus, frisee</p>
        </li>
        <li class="bmn-dish">
          <p class="bmn-dish-line mb-0"><span class="bmn-dish-name">Mushroom bourguignon</span><span class="bmn-leader" aria-hidden="true"></span><span class="bmn-price">$24</span></p>
          <p class="small bmn-bistro-muted mb-0">Pearl onions, red wine, celeriac puree <span class="badge rounded-pill bmn-diet"><span aria-hidden="true">VG</span><span class="visually-hidden">Vegan</span></span> <span class="badge rounded-pill bmn-diet"><span aria-hidden="true">GF</span><span class="visually-hidden">Gluten free</span></span></p>
        </li>
      </ul>
    </div>
    <div class="tab-pane fade" id="bmn-pane-sweet" role="tabpanel" aria-labelledby="bmn-tab-sweet" tabindex="0">
      <ul class="list-unstyled mb-0">
        <li class="bmn-dish">
          <p class="bmn-dish-line mb-0"><span class="bmn-dish-name">Tarte tatin</span><span class="bmn-leader" aria-hidden="true"></span><span class="bmn-price">$12</span></p>
          <p class="small bmn-bistro-muted mb-0">Caramelized apple, creme fraiche <span class="badge rounded-pill bmn-diet"><span aria-hidden="true">V</span><span class="visually-hidden">Vegetarian</span></span></p>
        </li>
        <li class="bmn-dish">
          <p class="bmn-dish-line mb-0"><span class="bmn-dish-name">Dark chocolate pot</span><span class="bmn-leader" aria-hidden="true"></span><span class="bmn-price">$10</span></p>
          <p class="small bmn-bistro-muted mb-0">Sea salt, olive oil, almond tuile <span class="badge rounded-pill bmn-diet"><span aria-hidden="true">V</span><span class="visually-hidden">Vegetarian</span></span></p>
        </li>
      </ul>
    </div>
  </div>
  <p class="small bmn-bistro-muted text-center border-top px-3 py-2 mb-0">V vegetarian, VG vegan, GF gluten free</p>
</div>

Cafe drinks board with filter pills

  • btn-check
  • list-group-flush
  • --bs-list-group-*
  • row-cols-md-2

Switch courses, filters or the pairing toggle.

A chalkboard-style drinks menu: two flush list groups recolored through their --bs-list-group-* variables, side by side from md up. The filter is a radio group of btn-check pills, and a short script hides the items that do not match and updates a live count.

View code
<section class="bmn-cafe w-100 rounded-4 p-3 p-sm-4" aria-labelledby="bmn-cafe-title">
  <div class="d-flex flex-wrap justify-content-between align-items-end gap-2 mb-3">
    <div>
      <h3 class="bmn-serif h4 mb-0" id="bmn-cafe-title">Copperline Coffee</h3>
      <p class="small bmn-cafe-muted mb-0">Espresso bar, open all day</p>
    </div>
    <p class="small bmn-cafe-muted mb-0" role="status" id="bmn-cafe-count">8 drinks</p>
  </div>
  <div class="d-flex flex-wrap gap-2 mb-3 bmn-cafe-filter" role="group" aria-label="Filter drinks">
    <input type="radio" class="btn-check" name="bmn-cafe-f" id="bmn-cafe-all" value="all" checked>
    <label class="btn btn-sm rounded-pill" for="bmn-cafe-all">All</label>
    <input type="radio" class="btn-check" name="bmn-cafe-f" id="bmn-cafe-hot" value="hot">
    <label class="btn btn-sm rounded-pill" for="bmn-cafe-hot">Hot</label>
    <input type="radio" class="btn-check" name="bmn-cafe-f" id="bmn-cafe-iced" value="iced">
    <label class="btn btn-sm rounded-pill" for="bmn-cafe-iced">Iced</label>
    <input type="radio" class="btn-check" name="bmn-cafe-f" id="bmn-cafe-decaf" value="decaf">
    <label class="btn btn-sm rounded-pill" for="bmn-cafe-decaf">Caffeine free</label>
  </div>
  <div class="row row-cols-1 row-cols-md-2 g-3 g-md-4">
    <div class="col">
      <h4 class="bmn-cafe-head">Espresso</h4>
      <ul class="list-group list-group-flush bmn-cafe-list">
        <li class="list-group-item px-0 bmn-cafe-item" data-bmn-tags="hot"><span class="bmn-dish-line"><span>Flat white</span><span class="bmn-cafe-leader" aria-hidden="true"></span><span class="bmn-cafe-price">4.20</span></span><span class="d-block small bmn-cafe-muted">Double ristretto, silky milk</span></li>
        <li class="list-group-item px-0 bmn-cafe-item" data-bmn-tags="hot"><span class="bmn-dish-line"><span>Cortado</span><span class="bmn-cafe-leader" aria-hidden="true"></span><span class="bmn-cafe-price">3.80</span></span><span class="d-block small bmn-cafe-muted">Equal parts espresso and milk</span></li>
        <li class="list-group-item px-0 bmn-cafe-item" data-bmn-tags="iced"><span class="bmn-dish-line"><span>Espresso tonic</span><span class="bmn-cafe-leader" aria-hidden="true"></span><span class="bmn-cafe-price">4.90</span></span><span class="d-block small bmn-cafe-muted">Over ice with orange peel</span></li>
        <li class="list-group-item px-0 bmn-cafe-item" data-bmn-tags="iced"><span class="bmn-dish-line"><span>Cold brew</span><span class="bmn-cafe-leader" aria-hidden="true"></span><span class="bmn-cafe-price">4.50</span></span><span class="d-block small bmn-cafe-muted">Steeped 18 hours</span></li>
      </ul>
    </div>
    <div class="col">
      <h4 class="bmn-cafe-head">Not coffee</h4>
      <ul class="list-group list-group-flush bmn-cafe-list">
        <li class="list-group-item px-0 bmn-cafe-item" data-bmn-tags="hot decaf"><span class="bmn-dish-line"><span>Turmeric latte</span><span class="bmn-cafe-leader" aria-hidden="true"></span><span class="bmn-cafe-price">4.40</span></span><span class="d-block small bmn-cafe-muted">Ginger, cinnamon, oat milk</span></li>
        <li class="list-group-item px-0 bmn-cafe-item" data-bmn-tags="hot"><span class="bmn-dish-line"><span>Matcha latte</span><span class="bmn-cafe-leader" aria-hidden="true"></span><span class="bmn-cafe-price">4.80</span></span><span class="d-block small bmn-cafe-muted">Ceremonial grade, whisked</span></li>
        <li class="list-group-item px-0 bmn-cafe-item" data-bmn-tags="iced decaf"><span class="bmn-dish-line"><span>Hibiscus cooler</span><span class="bmn-cafe-leader" aria-hidden="true"></span><span class="bmn-cafe-price">3.90</span></span><span class="d-block small bmn-cafe-muted">Lime, mint, sparkling water</span></li>
        <li class="list-group-item px-0 bmn-cafe-item" data-bmn-tags="hot decaf"><span class="bmn-dish-line"><span>Hot chocolate</span><span class="bmn-cafe-leader" aria-hidden="true"></span><span class="bmn-cafe-price">4.10</span></span><span class="d-block small bmn-cafe-muted">70% cacao, whipped cream</span></li>
      </ul>
    </div>
  </div>
</section>

Tasting menu card with a wine pairing switch

  • form-switch
  • Collapse JS API
  • aria-live
  • text-center

Switch courses, filters or the pairing toggle.

A printed-style tasting menu: centered serif courses inside a double rule made from a border and an inset outline. The form-switch calls bootstrap.Collapse on every pairing line with toggle set to false, so the wines slide in with the stock collapse transition while the price line updates in an aria-live region.

View code
<article class="bmn-tasting w-100 text-center px-4 py-4" aria-labelledby="bmn-tasting-title">
  <p class="bmn-tasting-kicker mb-1">Autumn at</p>
  <h3 class="bmn-serif h2 mb-1" id="bmn-tasting-title">Fennwick House</h3>
  <p class="small bmn-tasting-muted mb-4">Five courses, the whole table</p>
  <ol class="list-unstyled mb-4">
    <li class="bmn-course">
      <p class="bmn-serif mb-0">Beetroot, goat curd, toasted hazelnut</p>
      <div class="collapse bmn-pair"><p class="small fst-italic bmn-tasting-accent mb-0 pt-1">Gruner Veltliner, Kamptal 2023</p></div>
    </li>
    <li class="bmn-course">
      <p class="bmn-serif mb-0">Hand-dived scallop, brown butter, apple</p>
      <div class="collapse bmn-pair"><p class="small fst-italic bmn-tasting-accent mb-0 pt-1">Chablis Premier Cru 2022</p></div>
    </li>
    <li class="bmn-course">
      <p class="bmn-serif mb-0">Wild mushroom tortellini, aged parmesan</p>
      <div class="collapse bmn-pair"><p class="small fst-italic bmn-tasting-accent mb-0 pt-1">Etna Rosso 2021</p></div>
    </li>
    <li class="bmn-course">
      <p class="bmn-serif mb-0">Roast duck, quince, charred chicory</p>
      <div class="collapse bmn-pair"><p class="small fst-italic bmn-tasting-accent mb-0 pt-1">Pinot Noir, Central Otago 2020</p></div>
    </li>
    <li class="bmn-course">
      <p class="bmn-serif mb-0">Fig leaf ice cream, honeycomb</p>
      <div class="collapse bmn-pair"><p class="small fst-italic bmn-tasting-accent mb-0 pt-1">Tokaji Aszu 5 Puttonyos</p></div>
    </li>
  </ol>
  <div class="form-check form-switch d-inline-flex align-items-center gap-2 mb-2 bmn-tasting-switch">
    <input class="form-check-input" type="checkbox" role="switch" id="bmn-pairing">
    <label class="form-check-label small" for="bmn-pairing">Add wine pairing</label>
  </div>
  <p class="bmn-tasting-price mb-0" aria-live="polite" id="bmn-tasting-price">$120 per guest</p>
</article>

Navigation menus beyond the navbar

Full-screen overlays, nested category trees, icon lists, segmented pills, breadcrumb jump menus and footer columns. They use plain lists of links with aria-current for the current page, and Collapse or Offcanvas only where something has to open.

Hamburger button with a full-screen overlay menu

  • offcanvas-top
  • --bs-offcanvas-height
  • data-bs-theme="dark"
  • aria-current

Open the menu or expand a level.

An offcanvas-top panel stretched to the full viewport with --bs-offcanvas-height: 100vh, so the hamburger opens a full-screen menu with focus trapping, Esc and the backdrop handled by the plugin. data-bs-theme="dark" on the panel turns the close button white, and the big links stagger in only when the reader allows motion.

View code
<header class="bmn-ov-bar d-flex align-items-center justify-content-between px-3 px-sm-4 py-2">
  <a class="bmn-ov-brand text-decoration-none" href="#">Halden &amp; Rowe</a>
  <button class="btn bmn-ov-burger d-inline-flex align-items-center gap-2" type="button" data-bs-toggle="offcanvas" data-bs-target="#bmn-ov-menu" aria-controls="bmn-ov-menu">
    <span class="small fw-semibold">Menu</span>
    <span class="bmn-ov-lines" aria-hidden="true"><span></span><span></span></span>
  </button>
</header>
<div class="bmn-ov-hero position-relative">
  <img src="granite-valley.webp" class="w-100 h-100 object-fit-cover" alt="Granite cliffs rising over a pine forest and a still river">
  <div class="bmn-ov-caption position-absolute bottom-0 start-0 p-3 p-sm-4">
    <h3 class="bmn-ov-title mb-0">Buildings that sit quietly in the landscape.</h3>
  </div>
</div>
<div class="offcanvas offcanvas-top bmn-ov-panel" data-bs-theme="dark" tabindex="-1" id="bmn-ov-menu" aria-labelledby="bmn-ov-label">
  <div class="offcanvas-header px-3 px-sm-4">
    <h2 class="offcanvas-title bmn-ov-brand" id="bmn-ov-label">Halden &amp; Rowe</h2>
    <button type="button" class="btn-close" data-bs-dismiss="offcanvas" aria-label="Close menu"></button>
  </div>
  <div class="offcanvas-body px-3 px-sm-4 d-flex flex-column flex-md-row gap-4 justify-content-between">
    <nav aria-label="Main">
      <ul class="list-unstyled mb-0 bmn-ov-links">
        <li><a class="bmn-ov-link" href="#" aria-current="page">Projects</a></li>
        <li><a class="bmn-ov-link" href="#">Studio</a></li>
        <li><a class="bmn-ov-link" href="#">Journal</a></li>
        <li><a class="bmn-ov-link" href="#">Careers</a></li>
        <li><a class="bmn-ov-link" href="#">Contact</a></li>
      </ul>
    </nav>
    <div class="bmn-ov-side small">
      <p class="mb-1 bmn-ov-muted">Studio</p>
      <p class="mb-3">14 Wharf Lane, Bergen</p>
      <p class="mb-1 bmn-ov-muted">New work</p>
      <p class="mb-0"><a class="bmn-ov-mail" href="#">hello@haldenrowe.example</a></p>
    </div>
  </div>
</div>

Multi-level category menu with nested collapse

  • collapse
  • aria-expanded
  • aria-controls
  • aria-current

Open the menu or expand a level.

Bootstrap 5 has no nested dropdowns, so this three-level shop menu nests Collapse regions instead, which also works on touch screens. Each parent row keeps its link and gets a separate chevron button with its own aria-label, so a category page is still one click away, and the branch holding the current page starts open.

View code
<nav class="bmn-tree w-100 bg-body border rounded-3 shadow-sm p-2" aria-label="Shop categories">
  <ul class="list-unstyled mb-0">
    <li>
      <div class="bmn-tree-row">
        <a class="bmn-tree-link fw-semibold" href="#">Women</a>
        <button class="btn bmn-tree-btn" type="button" data-bs-toggle="collapse" data-bs-target="#bmn-tree-women" aria-expanded="true" aria-controls="bmn-tree-women" aria-label="Women subcategories"><i class="bi bi-chevron-right" aria-hidden="true"></i></button>
      </div>
      <ul class="list-unstyled collapse show bmn-tree-sub" id="bmn-tree-women">
        <li>
          <div class="bmn-tree-row">
            <a class="bmn-tree-link" href="#">Clothing</a>
            <button class="btn bmn-tree-btn" type="button" data-bs-toggle="collapse" data-bs-target="#bmn-tree-wclothing" aria-expanded="true" aria-controls="bmn-tree-wclothing" aria-label="Clothing subcategories"><i class="bi bi-chevron-right" aria-hidden="true"></i></button>
          </div>
          <ul class="list-unstyled collapse show bmn-tree-sub" id="bmn-tree-wclothing">
            <li><a class="bmn-tree-link" href="#">Dresses</a></li>
            <li><a class="bmn-tree-link" href="#" aria-current="page">Knitwear</a></li>
            <li><a class="bmn-tree-link" href="#">Coats and jackets</a></li>
          </ul>
        </li>
        <li>
          <div class="bmn-tree-row">
            <a class="bmn-tree-link" href="#">Shoes</a>
            <button class="btn bmn-tree-btn" type="button" data-bs-toggle="collapse" data-bs-target="#bmn-tree-wshoes" aria-expanded="false" aria-controls="bmn-tree-wshoes" aria-label="Shoes subcategories"><i class="bi bi-chevron-right" aria-hidden="true"></i></button>
          </div>
          <ul class="list-unstyled collapse bmn-tree-sub" id="bmn-tree-wshoes">
            <li><a class="bmn-tree-link" href="#">Boots</a></li>
            <li><a class="bmn-tree-link" href="#">Sneakers</a></li>
          </ul>
        </li>
      </ul>
    </li>
    <li>
      <div class="bmn-tree-row">
        <a class="bmn-tree-link fw-semibold" href="#">Home</a>
        <button class="btn bmn-tree-btn bmn-tree-home" type="button" data-bs-toggle="collapse" data-bs-target="#bmn-tree-home" aria-expanded="false" aria-controls="bmn-tree-home" aria-label="Home subcategories"><i class="bi bi-chevron-right" aria-hidden="true"></i></button>
      </div>
      <ul class="list-unstyled collapse bmn-tree-sub" id="bmn-tree-home">
        <li><a class="bmn-tree-link" href="#">Bedding</a></li>
        <li><a class="bmn-tree-link" href="#">Kitchen</a></li>
        <li><a class="bmn-tree-link" href="#">Lighting</a></li>
      </ul>
    </li>
    <li>
      <div class="bmn-tree-row">
        <a class="bmn-tree-link fw-semibold" href="#">Gift cards</a>
      </div>
    </li>
  </ul>
</nav>

Vertical menu with icons and badges

  • list-group-item-action
  • --bs-list-group-active-*
  • badge
  • aria-current

Open the menu or expand a level.

A course dashboard menu made from a list group of links. The --bs-list-group-* variables on a prefixed class remove the borders, round the items and turn the active item into a soft indigo pill, and the badges mix a count, a due warning and a lock. A short script moves active and aria-current to the clicked item.

View code
<nav class="bmn-course-nav w-100 bg-body border rounded-4 shadow-sm p-2" aria-label="Course">
  <p class="small fw-semibold text-body-secondary px-3 pt-2 mb-1">UX Writing Foundations</p>
  <div class="list-group bmn-lg">
    <a href="#" class="list-group-item list-group-item-action active" aria-current="page"><i class="bi bi-grid-1x2" aria-hidden="true"></i><span class="me-auto">Overview</span></a>
    <a href="#" class="list-group-item list-group-item-action"><i class="bi bi-play-circle" aria-hidden="true"></i><span class="me-auto">Lessons</span><span class="badge rounded-pill text-bg-light border">24</span></a>
    <a href="#" class="list-group-item list-group-item-action"><i class="bi bi-pencil-square" aria-hidden="true"></i><span class="me-auto">Assignments</span><span class="badge rounded-pill bmn-badge-due">3 due</span></a>
    <a href="#" class="list-group-item list-group-item-action"><i class="bi bi-chat-left-text" aria-hidden="true"></i><span class="me-auto">Discussions</span><span class="badge rounded-pill bmn-badge-new">New</span></a>
    <a href="#" class="list-group-item list-group-item-action"><i class="bi bi-bar-chart-line" aria-hidden="true"></i><span class="me-auto">Grades</span></a>
  </div>
  <hr class="my-2">
  <div class="list-group bmn-lg">
    <a href="#" class="list-group-item list-group-item-action"><i class="bi bi-people" aria-hidden="true"></i><span class="me-auto">Classmates</span><span class="badge rounded-pill text-bg-light border">118</span></a>
    <span class="list-group-item disabled" aria-disabled="true"><i class="bi bi-award" aria-hidden="true"></i><span class="me-auto">Certificate</span><i class="bi bi-lock-fill" aria-hidden="true"></i><span class="visually-hidden">locked</span></span>
  </div>
</nav>

Segmented and scrolling pill menus

  • nav-pills
  • --bs-nav-pills-*
  • nav-fill
  • flex-nowrap

Open the menu or expand a level.

Two nav-pills menus themed only through --bs-nav-pills-* and --bs-nav-link-* variables: a segmented control on a gray track with a white active segment, and a single-row category strip that scrolls sideways on small screens instead of wrapping. Both are lists of links, so the current page carries aria-current, and the script just moves it.

View code
<div class="bmn-seg w-100 bg-body border rounded-4 shadow-sm p-3 p-sm-4">
  <h3 class="h6 mb-2">Your account</h3>
  <nav aria-label="Account sections">
    <ul class="nav nav-pills nav-fill bmn-seg-track mb-4">
      <li class="nav-item"><a class="nav-link active" aria-current="page" href="#">Profile</a></li>
      <li class="nav-item"><a class="nav-link" href="#">Orders</a></li>
      <li class="nav-item"><a class="nav-link" href="#">Billing</a></li>
      <li class="nav-item"><a class="nav-link" href="#">Help</a></li>
    </ul>
  </nav>
  <h3 class="h6 mb-2">Shop by room</h3>
  <nav aria-label="Product categories">
    <ul class="nav nav-pills flex-nowrap gap-2 bmn-seg-scroll">
      <li class="nav-item"><a class="nav-link active" aria-current="page" href="#">All</a></li>
      <li class="nav-item"><a class="nav-link" href="#">Sofas</a></li>
      <li class="nav-item"><a class="nav-link" href="#">Chairs</a></li>
      <li class="nav-item"><a class="nav-link" href="#">Lighting</a></li>
      <li class="nav-item"><a class="nav-link" href="#">Rugs</a></li>
      <li class="nav-item"><a class="nav-link" href="#">Outdoor</a></li>
      <li class="nav-item"><a class="nav-link" href="#">Storage</a></li>
      <li class="nav-item"><a class="nav-link" href="#">Sale</a></li>
    </ul>
  </nav>
</div>

Context, action and command menus

Menus that run commands instead of loading pages: a right-click context menu, a floating action button, a desktop-style menu bar with keyboard shortcuts and a Ctrl+K command palette.

Right-click context menu at the pointer

  • dropdown-menu
  • reference option
  • getBoundingClientRect
  • contextmenu event

Right-click, long-press or use the buttons.

A real Bootstrap dropdown opened at the pointer: the Dropdown is created with a virtual reference object whose getBoundingClientRect returns the click point, so Popper places the menu there and keeps it inside the frame. Right-click or long-press a file, or use the Options button or the keyboard context menu key, and arrow keys, Esc and outside clicks behave like any dropdown.

View code
<div class="bmn-ctx w-100 bg-body border rounded-3 shadow-sm">
  <div class="d-flex align-items-center justify-content-between gap-2 border-bottom px-3 py-2">
    <h3 class="h6 mb-0">Brand assets</h3>
    <div class="dropdown">
      <button type="button" class="btn btn-sm btn-outline-secondary bmn-ctx-btn" id="bmn-ctx-btn" data-bs-toggle="dropdown" aria-expanded="false" aria-controls="bmn-ctx-menu"><i class="bi bi-three-dots me-1" aria-hidden="true"></i>Options</button>
      <ul class="dropdown-menu shadow bmn-ctx-menu" id="bmn-ctx-menu">
        <li><h4 class="dropdown-header bmn-ctx-name" id="bmn-ctx-name">logo-primary.svg</h4></li>
        <li><button type="button" class="dropdown-item bmn-ctx-act" data-bmn-act="Opened"><i class="bi bi-eye" aria-hidden="true"></i>Open</button></li>
        <li><button type="button" class="dropdown-item bmn-ctx-act" data-bmn-act="Renamed"><i class="bi bi-input-cursor-text" aria-hidden="true"></i>Rename</button></li>
        <li><button type="button" class="dropdown-item bmn-ctx-act" data-bmn-act="Duplicated"><i class="bi bi-copy" aria-hidden="true"></i>Duplicate</button></li>
        <li><button type="button" class="dropdown-item bmn-ctx-act" data-bmn-act="Moved"><i class="bi bi-folder-symlink" aria-hidden="true"></i>Move to folder</button></li>
        <li><hr class="dropdown-divider"></li>
        <li><button type="button" class="dropdown-item text-danger bmn-ctx-act" data-bmn-act="Deleted"><i class="bi bi-trash3" aria-hidden="true"></i>Delete</button></li>
      </ul>
    </div>
  </div>
  <ul class="list-unstyled mb-0 p-3 bmn-ctx-grid">
    <li><button type="button" class="bmn-ctx-file selected" aria-pressed="true"><i class="bi bi-filetype-svg" aria-hidden="true"></i><span>logo-primary.svg</span></button></li>
    <li><button type="button" class="bmn-ctx-file" aria-pressed="false"><i class="bi bi-file-earmark-image" aria-hidden="true"></i><span>hero-autumn.jpg</span></button></li>
    <li><button type="button" class="bmn-ctx-file" aria-pressed="false"><i class="bi bi-file-earmark-pdf" aria-hidden="true"></i><span>brand-guide.pdf</span></button></li>
    <li><button type="button" class="bmn-ctx-file" aria-pressed="false"><i class="bi bi-file-earmark-font" aria-hidden="true"></i><span>display-font.woff2</span></button></li>
    <li><button type="button" class="bmn-ctx-file" aria-pressed="false"><i class="bi bi-palette" aria-hidden="true"></i><span>palette.ase</span></button></li>
    <li><button type="button" class="bmn-ctx-file" aria-pressed="false"><i class="bi bi-file-earmark-play" aria-hidden="true"></i><span>intro-loop.mp4</span></button></li>
  </ul>
  <p class="small text-body-secondary border-top px-3 py-2 mb-0" role="status" id="bmn-ctx-status">Right-click or long-press a file</p>
</div>

Floating action button that fans out

  • aria-expanded
  • aria-controls
  • rounded-circle
  • --bs-btn-*

Right-click, long-press or use the buttons.

A notes app with a floating action button that reveals four labelled actions above it. The main button reports its state with aria-expanded and aria-controls, the hidden actions use visibility so they leave the tab order, and Esc or a click outside closes the stack and returns focus. The fan-out motion runs only under prefers-reduced-motion: no-preference.

View code
<div class="bmn-fabapp w-100 bg-body border rounded-4 shadow-sm position-relative overflow-hidden">
  <div class="px-3 pt-3 pb-2 border-bottom">
    <h3 class="h6 mb-0">Field notes</h3>
    <p class="small text-body-secondary mb-0" role="status" id="bmn-fab-status">4 notes, synced</p>
  </div>
  <ul class="list-group list-group-flush">
    <li class="list-group-item py-3"><span class="d-block fw-semibold">Site visit, Pier 9</span><span class="small text-body-secondary">Check drainage on the east ramp</span></li>
    <li class="list-group-item py-3"><span class="d-block fw-semibold">Client call recap</span><span class="small text-body-secondary">Swap tile sample, keep oak</span></li>
    <li class="list-group-item py-3"><span class="d-block fw-semibold">Materials list</span><span class="small text-body-secondary">12 items, 3 on backorder</span></li>
    <li class="list-group-item py-3"><span class="d-block fw-semibold">Ideas</span><span class="small text-body-secondary">Skylight over the stairwell?</span></li>
  </ul>
  <div class="bmn-fab-scrim" aria-hidden="true"></div>
  <div class="bmn-fab" id="bmn-fab">
    <button type="button" class="btn bmn-fab-main rounded-circle" id="bmn-fab-main" aria-expanded="false" aria-controls="bmn-fab-actions" aria-label="Create"><i class="bi bi-plus-lg" aria-hidden="true"></i></button>
    <ul class="list-unstyled mb-0 bmn-fab-actions" id="bmn-fab-actions">
      <li><button type="button" class="bmn-fab-act" data-bmn-act="Blank note created"><span class="bmn-fab-label">Blank note</span><span class="bmn-fab-mini"><i class="bi bi-pencil" aria-hidden="true"></i></span></button></li>
      <li><button type="button" class="bmn-fab-act" data-bmn-act="Checklist created"><span class="bmn-fab-label">Checklist</span><span class="bmn-fab-mini"><i class="bi bi-check2-square" aria-hidden="true"></i></span></button></li>
      <li><button type="button" class="bmn-fab-act" data-bmn-act="Recording voice memo"><span class="bmn-fab-label">Voice memo</span><span class="bmn-fab-mini"><i class="bi bi-mic" aria-hidden="true"></i></span></button></li>
      <li><button type="button" class="bmn-fab-act" data-bmn-act="Scan started"><span class="bmn-fab-label">Scan document</span><span class="bmn-fab-mini"><i class="bi bi-upc-scan" aria-hidden="true"></i></span></button></li>
    </ul>
  </div>
</div>

Ctrl+K command palette in a modal

  • modal
  • --bs-modal-*
  • list-group
  • role="combobox"

Right-click, long-press or use the buttons.

A command menu in a Bootstrap modal, opened by the button or Ctrl+K. The search input is an ARIA combobox that filters a listbox of commands, Up and Down move the highlighted option through aria-activedescendant, and Enter runs it. The modal size and corners come from the --bs-modal-* variables, and the shortcuts are kbd elements.

View code
<div class="bmn-cmd-launch w-100 text-center">
  <button type="button" class="btn bmn-cmd-open d-inline-flex align-items-center gap-2" data-bs-toggle="modal" data-bs-target="#bmn-cmd">
    <i class="bi bi-search" aria-hidden="true"></i><span>Search commands</span><kbd><kbd>Ctrl</kbd>+<kbd>K</kbd></kbd>
  </button>
  <p class="small text-body-secondary mt-3 mb-0" role="status" id="bmn-cmd-status">No command run yet</p>
</div>
<div class="modal fade bmn-cmd-modal" id="bmn-cmd" tabindex="-1" aria-labelledby="bmn-cmd-title" aria-hidden="true">
  <div class="modal-dialog">
    <div class="modal-content">
      <h2 class="visually-hidden" id="bmn-cmd-title">Command menu</h2>
      <div class="d-flex align-items-center gap-2 px-3 border-bottom">
        <i class="bi bi-search text-body-secondary" aria-hidden="true"></i>
        <input type="text" class="form-control border-0 shadow-none bmn-cmd-input" id="bmn-cmd-input" placeholder="Type a command" autocomplete="off" role="combobox" aria-expanded="true" aria-controls="bmn-cmd-list" aria-autocomplete="list" aria-label="Search commands">
        <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
      </div>
      <ul class="list-unstyled mb-0 p-2 bmn-cmd-list" id="bmn-cmd-list" role="listbox" aria-label="Commands">
        <li class="bmn-cmd-group small text-body-secondary px-2 pt-1 pb-1" role="presentation">Projects</li>
        <li class="bmn-cmd-opt" role="option" id="bmn-cmd-o1" aria-selected="false"><i class="bi bi-plus-square" aria-hidden="true"></i><span>New project</span><kbd><kbd>N</kbd></kbd></li>
        <li class="bmn-cmd-opt" role="option" id="bmn-cmd-o2" aria-selected="false"><i class="bi bi-person-plus" aria-hidden="true"></i><span>Invite teammate</span><kbd><kbd>I</kbd></kbd></li>
        <li class="bmn-cmd-opt" role="option" id="bmn-cmd-o3" aria-selected="false"><i class="bi bi-archive" aria-hidden="true"></i><span>Archive project</span></li>
        <li class="bmn-cmd-group small text-body-secondary px-2 pt-2 pb-1" role="presentation">Go to</li>
        <li class="bmn-cmd-opt" role="option" id="bmn-cmd-o4" aria-selected="false"><i class="bi bi-inbox" aria-hidden="true"></i><span>Inbox</span><kbd><kbd>G</kbd> <kbd>I</kbd></kbd></li>
        <li class="bmn-cmd-opt" role="option" id="bmn-cmd-o5" aria-selected="false"><i class="bi bi-calendar3" aria-hidden="true"></i><span>Calendar</span><kbd><kbd>G</kbd> <kbd>C</kbd></kbd></li>
        <li class="bmn-cmd-opt" role="option" id="bmn-cmd-o6" aria-selected="false"><i class="bi bi-gear" aria-hidden="true"></i><span>Settings</span><kbd><kbd>G</kbd> <kbd>S</kbd></kbd></li>
      </ul>
      <p class="small text-body-secondary px-3 py-3 mb-0 d-none" id="bmn-cmd-empty">No matching commands</p>
    </div>
  </div>
</div>

App and card menus

Menus that live inside a component: a tab bar at the bottom of a card, an appearance menu that switches color modes, and a bottom action sheet.

Tab bar menu at the bottom of an app card

  • nav-fill
  • Tab plugin
  • card-footer
  • --bs-nav-link-*

Tap the tabs or open the menu.

A smart-home card with a mobile-style tab bar in its footer. The bar is a nav-fill list driven by the Tab plugin, so it gets tab roles, aria-selected and arrow-key movement for free, and the panes sit above it in the card body. Icons stack over labels and the active tab turns terracotta through the --bs-nav-link-* variables.

View code
<div class="card bmn-home w-100 shadow-sm">
  <div class="card-body">
    <div class="tab-content">
      <section class="tab-pane fade show active" id="bmn-home-rooms" role="tabpanel" aria-labelledby="bmn-home-t1" tabindex="0">
        <h3 class="h5 mb-3">Rooms</h3>
        <ul class="list-unstyled mb-0 d-grid gap-2">
          <li class="bmn-home-row"><i class="bi bi-lamp" aria-hidden="true"></i><span class="me-auto">Living room<span class="d-block small text-body-secondary">21.5&deg;C, 3 lights on</span></span><div class="form-check form-switch m-0"><input class="form-check-input" type="checkbox" role="switch" id="bmn-home-l1" checked><label class="visually-hidden" for="bmn-home-l1">Living room lights</label></div></li>
          <li class="bmn-home-row"><i class="bi bi-moon-stars" aria-hidden="true"></i><span class="me-auto">Bedroom<span class="d-block small text-body-secondary">19&deg;C, lights off</span></span><div class="form-check form-switch m-0"><input class="form-check-input" type="checkbox" role="switch" id="bmn-home-l2"><label class="visually-hidden" for="bmn-home-l2">Bedroom lights</label></div></li>
          <li class="bmn-home-row"><i class="bi bi-cup-hot" aria-hidden="true"></i><span class="me-auto">Kitchen<span class="d-block small text-body-secondary">22&deg;C, 1 light on</span></span><div class="form-check form-switch m-0"><input class="form-check-input" type="checkbox" role="switch" id="bmn-home-l3" checked><label class="visually-hidden" for="bmn-home-l3">Kitchen lights</label></div></li>
        </ul>
      </section>
      <section class="tab-pane fade" id="bmn-home-energy" role="tabpanel" aria-labelledby="bmn-home-t2" tabindex="0">
        <h3 class="h5 mb-1">Energy today</h3>
        <p class="display-6 fw-semibold mb-3">8.4 <span class="fs-5 text-body-secondary">kWh</span></p>
        <p class="small mb-1">Heating</p>
        <div class="progress mb-2" role="progressbar" aria-label="Heating share" aria-valuenow="58" aria-valuemin="0" aria-valuemax="100"><div class="progress-bar bmn-home-bar" style="width: 58%"></div></div>
        <p class="small mb-1">Kitchen</p>
        <div class="progress mb-2" role="progressbar" aria-label="Kitchen share" aria-valuenow="27" aria-valuemin="0" aria-valuemax="100"><div class="progress-bar bmn-home-bar" style="width: 27%"></div></div>
        <p class="small mb-1">Lights</p>
        <div class="progress" role="progressbar" aria-label="Lights share" aria-valuenow="15" aria-valuemin="0" aria-valuemax="100"><div class="progress-bar bmn-home-bar" style="width: 15%"></div></div>
      </section>
      <section class="tab-pane fade" id="bmn-home-scenes" role="tabpanel" aria-labelledby="bmn-home-t3" tabindex="0">
        <h3 class="h5 mb-3">Scenes</h3>
        <div class="row row-cols-2 g-2">
          <div class="col"><button type="button" class="btn bmn-home-scene w-100"><i class="bi bi-sunrise d-block fs-4" aria-hidden="true"></i>Morning</button></div>
          <div class="col"><button type="button" class="btn bmn-home-scene w-100"><i class="bi bi-film d-block fs-4" aria-hidden="true"></i>Movie night</button></div>
          <div class="col"><button type="button" class="btn bmn-home-scene w-100"><i class="bi bi-house-lock d-block fs-4" aria-hidden="true"></i>Away</button></div>
          <div class="col"><button type="button" class="btn bmn-home-scene w-100"><i class="bi bi-moon d-block fs-4" aria-hidden="true"></i>Bedtime</button></div>
        </div>
      </section>
      <section class="tab-pane fade" id="bmn-home-alerts" role="tabpanel" aria-labelledby="bmn-home-t4" tabindex="0">
        <h3 class="h5 mb-3">Alerts</h3>
        <p class="mb-2"><i class="bi bi-door-open me-2 text-body-secondary" aria-hidden="true"></i>Back door opened at 7:42</p>
        <p class="mb-0"><i class="bi bi-droplet me-2 text-body-secondary" aria-hidden="true"></i>Humidity high in the bathroom</p>
      </section>
    </div>
  </div>
  <div class="card-footer bg-body p-1">
    <ul class="nav nav-fill bmn-home-tabs" role="tablist">
      <li class="nav-item" role="presentation"><button class="nav-link active" id="bmn-home-t1" data-bs-toggle="tab" data-bs-target="#bmn-home-rooms" type="button" role="tab" aria-controls="bmn-home-rooms" aria-selected="true"><i class="bi bi-house-door" aria-hidden="true"></i>Rooms</button></li>
      <li class="nav-item" role="presentation"><button class="nav-link" id="bmn-home-t2" data-bs-toggle="tab" data-bs-target="#bmn-home-energy" type="button" role="tab" aria-controls="bmn-home-energy" aria-selected="false"><i class="bi bi-lightning-charge" aria-hidden="true"></i>Energy</button></li>
      <li class="nav-item" role="presentation"><button class="nav-link" id="bmn-home-t3" data-bs-toggle="tab" data-bs-target="#bmn-home-scenes" type="button" role="tab" aria-controls="bmn-home-scenes" aria-selected="false"><i class="bi bi-magic" aria-hidden="true"></i>Scenes</button></li>
      <li class="nav-item" role="presentation"><button class="nav-link" id="bmn-home-t4" data-bs-toggle="tab" data-bs-target="#bmn-home-alerts" type="button" role="tab" aria-controls="bmn-home-alerts" aria-selected="false"><i class="bi bi-bell" aria-hidden="true"></i>Alerts<span class="badge rounded-pill bmn-home-dot">2</span></button></li>
    </ul>
  </div>
</div>

Dark mode app menu with an appearance switcher

  • data-bs-theme
  • nav-pills flex-column
  • dropdown-menu-end
  • matchMedia

Tap the tabs or open the menu.

A writing app that starts in dark mode with a vertical nav-pills menu. The Appearance dropdown sets data-bs-theme on the app wrapper to light or dark, or follows prefers-color-scheme for Auto, the same idea as the color mode toggler in the Bootstrap docs. Every color comes from Bootstrap tokens such as --bs-body-bg and --bs-tertiary-bg, so both modes work with no extra CSS.

View code
<div class="bmn-app w-100 bg-body text-body border rounded-4 shadow-sm overflow-visible" data-bs-theme="dark" id="bmn-app">
  <div class="d-flex align-items-center justify-content-between gap-2 px-3 py-2 border-bottom">
    <span class="fw-semibold"><i class="bi bi-feather me-2 bmn-app-accent" aria-hidden="true"></i>Quillnote</span>
    <div class="dropdown">
      <button type="button" class="btn btn-sm bmn-app-theme-btn d-inline-flex align-items-center gap-2" data-bs-toggle="dropdown" aria-expanded="false"><i class="bi bi-circle-half" aria-hidden="true"></i>Appearance</button>
      <ul class="dropdown-menu dropdown-menu-end shadow bmn-app-theme-menu">
        <li><button type="button" class="dropdown-item d-flex align-items-center gap-2" data-bmn-theme="light" aria-pressed="false"><i class="bi bi-sun" aria-hidden="true"></i><span class="me-auto">Light</span><i class="bi bi-check2 bmn-app-check" aria-hidden="true"></i></button></li>
        <li><button type="button" class="dropdown-item d-flex align-items-center gap-2 active" data-bmn-theme="dark" aria-pressed="true"><i class="bi bi-moon-stars" aria-hidden="true"></i><span class="me-auto">Dark</span><i class="bi bi-check2 bmn-app-check" aria-hidden="true"></i></button></li>
        <li><button type="button" class="dropdown-item d-flex align-items-center gap-2" data-bmn-theme="auto" aria-pressed="false"><i class="bi bi-circle-half" aria-hidden="true"></i><span class="me-auto">Auto</span><i class="bi bi-check2 bmn-app-check" aria-hidden="true"></i></button></li>
      </ul>
    </div>
  </div>
  <div class="d-flex flex-column flex-sm-row">
    <nav class="p-2 bmn-app-side" aria-label="Library">
      <ul class="nav nav-pills flex-sm-column gap-1 bmn-app-nav">
        <li class="nav-item"><a class="nav-link active" aria-current="page" href="#"><i class="bi bi-journal-text" aria-hidden="true"></i>Drafts<span class="badge rounded-pill text-bg-secondary ms-auto">7</span></a></li>
        <li class="nav-item"><a class="nav-link" href="#"><i class="bi bi-send" aria-hidden="true"></i>Published</a></li>
        <li class="nav-item"><a class="nav-link" href="#"><i class="bi bi-star" aria-hidden="true"></i>Starred</a></li>
        <li class="nav-item"><a class="nav-link" href="#"><i class="bi bi-trash3" aria-hidden="true"></i>Trash</a></li>
      </ul>
    </nav>
    <div class="flex-grow-1 p-3 border-top bmn-app-main">
      <p class="small text-body-secondary mb-1">Edited 4 minutes ago</p>
      <h3 class="h5">Notes on slow travel</h3>
      <p class="mb-0 text-body-secondary">Trains first, planes only when the sea is in the way. The night train to the coast leaves at 21:40.</p>
    </div>
  </div>
</div>

Bottom action sheet from offcanvas

  • offcanvas-bottom
  • --bs-offcanvas-height
  • list-group
  • data-bs-dismiss

Tap the tabs or open the menu.

A photo card whose kebab button opens a mobile-style action sheet: offcanvas-bottom with an automatic height, rounded top corners and a max width so it reads as a sheet on desktop too. The actions are a list group of buttons and a separate Cancel, and the plugin brings focus trapping, the backdrop and Esc.

View code
<div class="card bmn-photo w-100 shadow-sm">
  <img src="coast-road.webp" class="card-img-top" alt="Winding road on a pine-covered coastal hillside above the sea at sunset">
  <div class="card-body d-flex align-items-start justify-content-between gap-2">
    <div>
      <h3 class="h6 mb-1">Coast road, Mallorca</h3>
      <p class="small text-body-secondary mb-0" role="status" id="bmn-sheet-status">Shot on a 35mm lens</p>
    </div>
    <button type="button" class="btn bmn-photo-more" data-bs-toggle="offcanvas" data-bs-target="#bmn-sheet" aria-controls="bmn-sheet" aria-label="Photo actions"><i class="bi bi-three-dots" aria-hidden="true"></i></button>
  </div>
</div>
<div class="offcanvas offcanvas-bottom bmn-sheet" tabindex="-1" id="bmn-sheet" aria-labelledby="bmn-sheet-title">
  <div class="bmn-sheet-handle" aria-hidden="true"></div>
  <div class="offcanvas-header pt-2 pb-2">
    <h2 class="offcanvas-title h6 mx-auto text-body-secondary" id="bmn-sheet-title">Coast road, Mallorca</h2>
  </div>
  <div class="offcanvas-body pt-0">
    <div class="list-group bmn-sheet-list mb-2">
      <button type="button" class="list-group-item list-group-item-action bmn-sheet-act" data-bmn-act="Shared" data-bs-dismiss="offcanvas"><i class="bi bi-share" aria-hidden="true"></i>Share</button>
      <button type="button" class="list-group-item list-group-item-action bmn-sheet-act" data-bmn-act="Added to Summer 2026" data-bs-dismiss="offcanvas"><i class="bi bi-collection" aria-hidden="true"></i>Add to album</button>
      <button type="button" class="list-group-item list-group-item-action bmn-sheet-act" data-bmn-act="Set as cover" data-bs-dismiss="offcanvas"><i class="bi bi-image" aria-hidden="true"></i>Use as cover</button>
      <button type="button" class="list-group-item list-group-item-action bmn-sheet-act text-danger" data-bmn-act="Moved to trash" data-bs-dismiss="offcanvas"><i class="bi bi-trash3" aria-hidden="true"></i>Delete photo</button>
    </div>
    <button type="button" class="btn bmn-sheet-cancel w-100" data-bs-dismiss="offcanvas">Cancel</button>
  </div>
</div>

What are Bootstrap menus?

In practice the phrase covers anything built from Bootstrap’s predefined classes and data attributes that opens, closes or collapses a list of links.

These pieces belong to the wider Bootstrap component library, which also holds cards, modals and forms. Bootstrap’s JavaScript docs call data attributes the preferred way to switch plugins on, so most menus need no hand-written script.

  • The navbar is the site header, with a brand, links and a toggler that collapses at a set breakpoint.
  • A nav is a flexbox link list that can be restyled into tabs, pills or an underline variant.
  • Dropdown overlays a toggleable list of links, opened by click.
  • Offcanvas gives you a sidebar panel that slides in from the left, right, top or bottom edge of the viewport.
  • List group stacks items, and its links and buttons can act as navigation.

In Bootstrap 5, “menu” is an umbrella term and not a class name. The v6.0.0-alpha.1 release notes on GitHub rename the Dropdown component to Menu, and the v6 docs use .menu and .menu-item classes.

Version 6 is still an alpha as of October 2026, so everything below assumes Bootstrap 5.3 unless it says otherwise.

None of these components is an ARIA menu. The 5.3 docs reserve the WAI-ARIA role=”menu” widget for application-like menus that trigger actions, and Bootstrap does not add those roles for you.

Which Bootstrap menu component fits which job?

Site-wide links go in a navbar. A link list behind a button is a dropdown, and a slide-in panel is offcanvas. Secondary and sidebar navigation usually ends up as a nav or a list group.

ComponentJobJavaScriptSmall-screen behavior
NavbarSite header, primary linksCollapse plugin for the togglerCollapses below the navbar-expand breakpoint
DropdownLink list behind a toggleDropdown pluginOpens on click at any width
OffcanvasSlide-in panelOffcanvas pluginHidden until toggled; offcanvas-lg shows it inline from lg up
NavSecondary or tab-style linksNone for links; Tab plugin for panesNo built-in collapse; use flex utilities
List groupStacked items, sidebar menusNone for links; Tab plugin for panesNo built-in collapse; horizontal variants per breakpoint

The navbar carries primary website navigation and collapses behind a toggler on its own. Default to it.

Offcanvas earns its place once the mobile menu holds more than links, say search and account controls. It opens over the page with a backdrop that closes it on click, per the offcanvas docs.

A persistent left-hand column is a job for a vertical nav (flex-column) or a list group. A Bootstrap sidebar can pair either one with a responsive offcanvas for small screens.

There’s one combination to avoid. A nav styled as tabs can hold a dropdown visually, but the tab plugin does not support tabbed interfaces where a tab trigger sits inside the dropdown menu. The Bootstrap docs cite usability and accessibility problems as the reason.

How to build a responsive navbar in Bootstrap

Nest the wrapper, container, brand, toggler, collapse region and link list in that order. Skip a layer and either the toggler dies or the layout falls apart.

  1. Load Bootstrap CSS in the head and the JavaScript bundle (bootstrap.bundle.min.js) before the closing body tag. The 5.3 docs examples pull both from jsDelivr at version 5.3.8.
  2. Add a nav element with the classes navbar, navbar-expand-lg and bg-body-tertiary.
  3. Put a div with container-fluid inside it. Bootstrap 5 requires a container within the navbar, according to the v5 migration notes.
  4. Add the brand as an anchor with navbar-brand. An anchor works best, and the content can be text, an image or both.
  5. Add a button with navbar-toggler, data-bs-toggle=”collapse”, a data-bs-target pointing at the collapse region, aria-controls, aria-expanded=”false” and aria-label=”Toggle navigation”. Put a span with navbar-toggler-icon inside it.
  6. Add a div with collapse and navbar-collapse, using the id the toggler targets.
  7. Inside it, add a ul with navbar-nav, then an li with nav-item and an anchor with nav-link for each page.

Mark the current page with active on the nav-link plus aria-current=”page”. In Bootstrap 5, active can no longer sit on the nav-item, a v4 habit the migration notes list as a breaking change.

The classic breakage is an id mismatch. If data-bs-target says #navbarNav and the collapse div says navbarMain, the toggler opens nothing.

Search forms, centered brands and other layouts are covered in a dedicated Bootstrap navbar tutorial.

How does a Bootstrap navbar collapse on mobile?

Whatever breakpoint sits in the navbar-expand class decides it. Narrower than that, the links hide behind a toggler button. Wider, they sit in a row.

The toggler shows the standard hamburger menu icon, drawn from an SVG background image rather than an icon font.

Breakpoint classes

The collapse point comes from a suffix on navbar-expand: sm, md, lg, xl or xxl, per the Bootstrap 5.3 navbar docs.

  • navbar-expand-lg collapses below lg and shows a full row from lg up
  • navbar-expand never collapses
  • no expand class at all means always collapsed

Count the links before picking one. A short list can stay expanded down to md, while a long one needs xl.

Toggler placement follows the markup. A toggler written after the brand lands on the far right, and writing it first puts it on the left.

A toggler can also control a container outside the navbar, because the Collapse plugin matches the id to data-bs-target. The docs recommend adding JavaScript that moves focus to that container once it opens, since keyboard and assistive technology users otherwise struggle to find it.

Offcanvas navbar

Swap the collapse region for an offcanvas panel and the navbar slides its links in from the edge. The toggler then carries data-bs-toggle=”offcanvas” instead of collapse.

Pair the panel with navbar-expand-lg and it flattens back into a normal row from lg up. Leave the expand class off and the slide-in drawer stays at every width.

  • Only one offcanvas shows at a time
  • A backdrop closes it on click unless the backdrop option is static
  • Esc closes it by default
  • Body scrolling stays off while it is open, unless data-bs-scroll is set

A dark navbar does not darken the panel. Set data-bs-theme=”dark” on a wrapper or add text-bg-dark to the offcanvas, or the text turns illegible on the light background.

Scrolling long menus

By default a scrolling navbar menu is capped at 75vh, according to the navbar docs.

Add navbar-nav-scroll to a navbar-nav and the open menu scrolls instead of running off the screen. Override the height with a local CSS custom property when 75vh is wrong for your layout.

There’s a catch, though. Setting overflow-y to auto turns overflow-x into auto as well, so some horizontal content gets cropped.

JavaScript requirements for Bootstrap menus

The navbar toggler runs on the Collapse plugin, and anything that overlays links runs on Dropdown. Drawers use Offcanvas. With JavaScript disabled the plugins have no fallback, so a toggler does nothing (Bootstrap 5.3 JavaScript docs).

Bootstrap 5.0.0 dropped the jQuery dependency, and the 5.3 docs treat jQuery as optional. Bootstrap 4 builds are the ones that still lean on it.

Loading the code comes down to a few options.

  • bootstrap.bundle.min.js is one file with Popper included
  • bootstrap.min.js plus Popper, with Popper loaded first and only one of bootstrap.js or bootstrap.min.js on the page
  • ESM in the browser, which needs an import map to resolve Popper

Popper positions dropdowns, popovers and tooltips. It does not position dropdowns inside a navbar, where Bootstrap sets data-bs-popper=”static” and skips dynamic placement, as the v5 migration notes describe.

Attributes do the wiring. data-bs-toggle picks the plugin (collapse, dropdown or offcanvas), and data-bs-target points a toggler at the element it controls by selector.

Why menus stop working

  • If no JavaScript is loaded, the CSS still renders the navbar but the toggler is dead.
  • Bootstrap 4 attributes stop responding in version 5, which namespaces them as data-bs-toggle and data-bs-target, so data-toggle markup does nothing.
  • data-bs-target must be a valid selector that matches the collapse region’s id, and special characters need escaping.
  • A single element takes one set of data attributes, so a toggler cannot also trigger a tooltip.
  • Bootstrap’s docs warn that React, Vue and Angular mutate the same DOM, which leaves dropdowns stuck open, and point to React Bootstrap and ng-bootstrap instead.

Check the loaded scripts first, then the target ids.

Adding a dropdown menu to a navbar

The structure is a nav-item with the dropdown class wrapping a nav-link toggle and a dropdown-menu list. The docs ask for separate nested elements for nav-item and nav-link because the menu needs a wrapper to position against.

The plugin behind the Bootstrap dropdown component also drives standalone button dropdowns, so most of what follows applies outside navbars too. Dropdowns open on click, not hover, which the docs call an intentional design decision.

  • Start with an anchor carrying nav-link, dropdown-toggle, role=”button”, data-bs-toggle=”dropdown” and aria-expanded=”false” as the toggle.
  • The menu itself is a ul with dropdown-menu, and each entry is an li wrapping an anchor with dropdown-item.
  • For a divider, put an hr with dropdown-divider inside its own li.

Directions and alignment

Direction classes go on the parent element, alignment classes on the menu itself.

ClassMenu opens
dropupAbove the toggle
dropendTo the right of the toggle
dropstartTo the left of the toggle
dropdown-centerCentered below the toggle

Directions flip in RTL layouts, so dropstart appears on the right there. Add dropdown-menu-end to right-align a menu.

Responsive variants such as dropdown-menu-lg-end need data-bs-display=”static” outside a navbar. Inside one you can skip the attribute, because Popper is not in play.

Auto-close behavior

By default a dropdown closes on any click, inside or outside. The data-bs-auto-close attribute changes that.

  • true is the default, and a click inside or outside closes the menu
  • inside closes it only on clicks inside
  • outside closes it only on clicks outside
  • false leaves closing to the toggle or a script

A form inside a dropdown needs outside, otherwise the first click in a field shuts the menu. The 5.3 docs use exactly that setting in their login form example.

Fixed and sticky navbar placement

Use sticky-top when the navbar should scroll with the page and then stay put at the top, and fixed-top when it should be pinned to the viewport from the first pixel. Sticky costs nothing in layout, while fixed does.

  • fixed-top pins the bar edge to edge at the top of the viewport and pulls it out of the page flow
  • fixed-bottom does the same at the bottom edge
  • sticky-top scrolls with the page until it reaches the top, then stays
  • sticky-bottom scrolls until it reaches the bottom, then stays

A fixed navbar reserves no space, so page content slides underneath it. The navbar docs suggest padding-top on the body to compensate.

A sticky navigation bar keeps its place in the flow, so there is nothing to compensate for. That makes it the lower-maintenance default for most sites.

Responsive variants such as sticky-md-top pin the bar only from that breakpoint up. On phones the bar scrolls away with the page instead of holding screen space.

Placement breaks in two common ways.

  • A parent with overflow set to hidden, scroll or auto becomes the scroll container, and a sticky navbar sticks to that parent instead of the viewport (MDN)
  • A transform, perspective or filter on an ancestor makes that ancestor the containing block, so fixed-top stops pinning to the viewport (MDN)

Stacking order matters too. Bootstrap’s default scale puts sticky at 1020 and fixed at 1030, with offcanvas at 1045 above both, per the 5.3 z-index docs.

A custom banner with a higher z-index covers the navbar. If you change one value in the scale, the docs advise changing all of them.

Navbar theming with color modes and CSS variables

Set data-bs-theme=”dark” on the navbar to switch it to the dark color mode. The attribute arrived in Bootstrap 5.3.0 and replaces the deprecated navbar-dark class.

Old classCurrent approachDeprecated in
navbar-darkdata-bs-theme=”dark” on the navbar or a parent5.3.0
navbar-lightDefault light navbar variables5.2.0
dropdown-menu-darkdata-bs-theme=”dark” on the dropdown or a wrapper5.3.0
btn-close-whitedata-bs-theme=”dark” on the button or a parent5.3.0

The attribute is scoped. On the html element it applies to the whole page, and on a navbar it applies to that navbar and what sits inside it.

A dark bar on a light page is one attribute plus a background utility such as bg-primary.

Since 5.2.0, navbar colors live in CSS variables scoped to the navbar base class. Override them on your own selector instead of rewriting Bootstrap’s rules.

  • –bs-navbar-color and –bs-navbar-hover-color for link states
  • –bs-navbar-brand-color for the brand
  • –bs-navbar-toggler-icon-bg for the hamburger image

If you compile from source, Sass variables such as $navbar-dark-color set the defaults those CSS variables start from.

Custom colors need a check. Bootstrap’s accessibility docs warn that some default palette combinations fall below the WCAG 2.2 text ratio of 4.5:1, and some below the non-text ratio of 3:1, particularly on light backgrounds.

Run a color contrast test on link, hover and toggler colors against whichever bg-* class you picked.

Are Bootstrap menus accessible by default?

Partly. Bootstrap supplies keyboard movement, focus handling and reduced-motion support, and leaves the semantic wrapper around a navigation menu to the author.

Bootstrap’s own accessibility page puts the overall web accessibility of a project largely on the author’s markup, styling and scripting. It adds that generic components often need extra roles and attributes.

Some of it comes built in.

  • Cursor keys move through dropdown items, and Esc closes the menu
  • Collapse and offcanvas transitions follow the prefers-reduced-motion setting
  • The offcanvas plugin adds role=”dialog” itself

The rest is yours to add.

  • A nav element or role=”navigation” on the container, never on the ul itself
  • aria-labelledby on every offcanvas, pointing at its title
  • aria-controls on dropdown toggles, which the docs’ examples leave out
  • No tab roles on a nav styled as tabs, because role=”tablist”, role=”tab” and role=”tabpanel” belong to dynamic tab interfaces only

The W3C’s ARIA pattern guidance takes a different route for site navigation than the menu role. Its disclosure navigation example (page updated January 2026) pairs buttons carrying aria-expanded and aria-controls with plain link lists, because typical site navigation does not need menu-widget keyboard behavior.

Bootstrap’s navbar dropdowns already match that shape, minus aria-controls.

The v6 alpha Menu goes further. It adds aria-haspopup=”true” to submenu triggers, keeps aria-expanded in sync, and supports Home, End and arrow-key movement, according to the v6 Menu docs.

Multilevel dropdowns and hover menus: what Bootstrap 5 does not support

Bootstrap 5.3 documents no multilevel dropdown, and its dropdown toggle cannot double as a link to a parent page. Both limits are old, and both trace back to deliberate decisions.

  • Nested dropdowns were dropped in Bootstrap 3
  • A maintainer reply in GitHub issue 21026 (October 27, 2016) says they have not been supported since v3
  • The Bootstrap 5.3 dropdown docs describe single-level menus only

The same thread gives the reasons as poor behavior on mobile and the JavaScript needed to get desktop right. It also records the maintainer’s position that the omission has not stopped anyone from building their own.

The working examples tend to rely on extra CSS and JavaScript, as the Pinegrow tutorial for Bootstrap 4 shows.

The workarounds carry their own costs.

  • Pinegrow’s Bootstrap 4 recipe pastes in custom CSS and a jQuery script, then adds a second script version to fix a “$ is not a function” error
  • In a support thread for MDB, a library built on Bootstrap, tapping a submenu on 5.3 closes the whole dropdown on mobile
  • One commenter in the issue thread suggests submenus that also expand on click or tap, not only on hover, so they keep working on touch screens

Hover is a separate story. The 2012 post by Bootstrap co-creator Mark Otto (February 27, 2012) explains the choice. Dropdowns opened on hover before the project went open source, and the team switched because the menu vanishes as soon as the cursor leaves.

His rule is that hover indicates and click acts. Opening a dropdown is an explicit action, which is also why the toggle cannot be a link to its own page.

Hover menus are still easy to build outside the framework, and plenty of pure CSS dropdown menus open on :hover with no script. Any hover-triggered menu still needs a way to dismiss it without moving the pointer, such as Esc, to meet WCAG 1.4.13, as the W3C’s navigation example shows.

If the site architecture truly needs three levels, a purpose-built JavaScript menu beats stacking hacks on Bootstrap’s dropdown plugin. Flattening to one level plus a collapse-based mobile menu is the cheaper fix for everything else.

Bootstrap 5.3 or Bootstrap 6 alpha: which version should menus use?

Build production menus on Bootstrap 5.3. The first Bootstrap 6 alpha shipped on October 8, 2026, and the maintainers say things can still change meaningfully before beta (official Bootstrap blog).

  • Bootstrap 5.3.8 is the latest stable, released August 25, 2025, with v5.4.0 planned before any end-of-life date for v5 is announced
  • Bootstrap 4.6.2 was the final v4 release, and v4 reached end of life on January 1, 2023 (Bootstrap’s end-of-life page)
  • Bootstrap 6.0.0-alpha.1 is a preview, with more alphas ahead of beta and release candidates
ItemBootstrap 5.3Bootstrap 6 alpha
Dropdown componentDropdown: dropdown-menu, dropdown-itemMenu: menu, menu-item
Toggle and directiondata-bs-toggle=”dropdown”; dropup, dropend, dropstartdata-bs-toggle=”menu”; data-bs-placement
Positioning libraryPopperFloating UI
Mobile navbar menucollapse navbar-collapse, or offcanvasDrawer, built on a native dialog element
Nested menusNot supportedsubmenu class, hover and click

Navbars take a direct hit too. navbar-expand-md becomes md:navbar-expand, navbar-light and navbar-dark are removed, and the breakpoint scale moves: lg grows from 992px to 1024px and xxl becomes 2xl (v6 migration guide).

The same guide lists navbar expansion among the features that now respond to a parent query container instead of the viewport.

The v6 submenu answers the limits above directly. Submenus support hover and click activation and keyboard navigation, and they can be nested to multiple levels.

Below 576px they stack over the parent menu with a back button instead of flying out sideways, per the v6 Menu docs.

The larger cost is the browser floor. Bootstrap 6 requires Chrome and Edge 130, Firefox 132 and Safari 18, against Chrome and Firefox 60 and Safari 12 for v5, and it ships no fallbacks, prefixes or polyfills below that line.

That floor rewrites your cross-browser compatibility checklist. Check your analytics before planning a migration.

My rule is simple.

  • Anything shipping to users stays on Bootstrap 5.3
  • A site still on Bootstrap 4 should move to 5.3 first
  • A prototype that needs native submenus can try the Bootstrap 6 alpha, on a branch you can throw away

Common Questions About Bootstrap Menus

How do I center or right-align navbar links?

Add ms-auto to the navbar-nav list to push links to the right, or mx-auto to center them. The navbar docs point to flex and spacing utilities for alignment, and standalone nav components take justify-content-center or justify-content-end instead.

How do I close the mobile menu after clicking a link?

Call hide() on the Collapse instance from a click handler on the nav links, for example through bootstrap.Collapse.getOrCreateInstance.

A normal page load closes the menu on its own, so the handler only matters for same-page anchors and single-page apps.

Can a Bootstrap navbar include a search form?

Yes. Place a form with the d-flex class and role=”search” inside the navbar, holding an input with form-control and a submit button.

Put it inside the collapse region so it folds away on small screens, or outside the region to keep it visible at every width.

Does Bootstrap have a mega menu?

No. Bootstrap 5.3 ships no mega menu component, but its dropdown menus accept custom content such as text and forms, so the usual build places a grid of columns inside one.

Expect custom CSS for full-width placement, and test the collapsed layout on small screens.

Testing Bootstrap Menus Before Launch

Run the checks on the production build, and start with the keyboard, then touch, then a screen reader.

Keyboard goes first because it needs no extra device and exposes focus order and Escape behavior early.

  • Tab, Enter, Space and Escape through every dropdown
  • Toggle button and tap targets on a real phone
  • Expanded and collapsed states announced by a screen reader

The cost is time. Manual passes on three input types take longer than one automated scan, and a scan cannot judge how a state change sounds to a listener.

As of October 29, 2026, a Bootstrap 6 beta release would change this test plan, since the renamed Menu and Drawer components need their own pass.