Snippets Menu

Bootstrap 5 Navbar with Multi-Level Dropdown Submenus

A responsive navbar with a Product dropdown that opens nested submenus on hover, tap or keyboard, plus help, login and sign-up actions.

Bootstrap 5 No jQuery Nov 2019 3.9K views

<section class="wdw-stage">
  <div class="container" style="max-width:1080px">
    <div class="wdw-card nv-window">
      <nav class="navbar navbar-expand-lg px-3 px-lg-4 py-3 nv-bar" aria-label="Main">
        <a class="navbar-brand d-flex align-items-center gap-2 fw-bold wdw-heading me-4" href="#">
          <span class="wdw-icon nv-logo"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M12 2 3 7v10l9 5 9-5V7z"/><path d="M12 22V12M3 7l9 5 9-5"/></svg></span>
          Wrapkit
        </a>
        <button class="navbar-toggler border-0 shadow-none" type="button" data-bs-toggle="collapse" data-bs-target="#nvMenu" aria-controls="nvMenu" aria-expanded="false" aria-label="Toggle navigation">
          <span class="navbar-toggler-icon"></span>
        </button>
        <div class="collapse navbar-collapse" id="nvMenu">
          <ul class="navbar-nav me-auto gap-lg-1 mt-3 mt-lg-0">
            <li class="nav-item"><a class="nav-link active" aria-current="page" href="#">Home</a></li>
            <li class="nav-item dropdown nv-hover">
              <a class="nav-link dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown" aria-expanded="false">Product</a>
              <ul class="dropdown-menu nv-menu p-2 border-0">
                <li><a class="dropdown-item rounded-3" href="#">Overview</a></li>
                <li><a class="dropdown-item rounded-3" href="#">Pricing</a></li>
                <li><a class="dropdown-item rounded-3" href="#">Changelog</a></li>
                <li><hr class="dropdown-divider"></li>
                <li class="nv-sub">
                  <a class="dropdown-item rounded-3 d-flex justify-content-between align-items-center nv-sub-toggle" href="#" role="button" aria-haspopup="true" aria-expanded="false">Integrations
                    <svg class="nv-chev" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.25" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m9 6 6 6-6 6"/></svg>
                  </a>
                  <ul class="dropdown-menu nv-menu nv-submenu p-2 border-0">
                    <li><a class="dropdown-item rounded-3" href="#">Slack</a></li>
                    <li><a class="dropdown-item rounded-3" href="#">GitHub</a></li>
                    <li class="nv-sub">
                      <a class="dropdown-item rounded-3 d-flex justify-content-between align-items-center nv-sub-toggle" href="#" role="button" aria-haspopup="true" aria-expanded="false">Analytics
                        <svg class="nv-chev" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.25" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m9 6 6 6-6 6"/></svg>
                      </a>
                      <ul class="dropdown-menu nv-menu nv-submenu p-2 border-0">
                        <li><a class="dropdown-item rounded-3" href="#">Google Analytics</a></li>
                        <li><a class="dropdown-item rounded-3" href="#">Plausible</a></li>
                        <li><a class="dropdown-item rounded-3" href="#">Mixpanel</a></li>
                      </ul>
                    </li>
                  </ul>
                </li>
                <li><a class="dropdown-item rounded-3" href="#">API reference</a></li>
              </ul>
            </li>
            <li class="nav-item"><a class="nav-link" href="#">Features</a></li>
            <li class="nav-item"><a class="nav-link" href="#">About us</a></li>
            <li class="nav-item"><a class="nav-link" href="#">Contact</a></li>
          </ul>
          <div class="d-flex flex-column flex-lg-row align-items-lg-center gap-2 gap-lg-3 mt-3 mt-lg-0">
            <a class="nav-link d-flex align-items-center gap-2" href="#">
              <svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M21 12a8 8 0 0 1-11.6 7.1L4 20l1-4.6A8 8 0 1 1 21 12z"/></svg>
              Need help?
            </a>
            <a class="nav-link" href="#">Log in</a>
            <a class="btn btn-primary rounded-pill px-4" href="#">Sign up</a>
          </div>
        </div>
      </nav>
      <div class="p-3 p-lg-4">
        <div class="nv-hero wdw-aurora rounded-4 px-4 px-lg-5 py-4 d-flex align-items-start justify-content-lg-end">
          <div class="col-lg-4 pt-lg-2">
            <h2 class="fw-bold h3 mb-3 text-white">Menus that work on every screen</h2>
            <div class="d-flex gap-2 flex-wrap flex-lg-nowrap">
              <a href="#" class="btn btn-light rounded-pill px-3">Get started</a>
              <a href="#" class="btn btn-outline-light rounded-pill px-3 text-nowrap">Read the docs</a>
            </div>
          </div>
        </div>
        <div class="row g-3 mt-1">
          <div class="col-md-4"><div class="d-flex gap-3 align-items-start p-3 wdw-card-sm h-100"><span class="wdw-icon"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M5 12h14M13 6l6 6-6 6"/></svg></span><div><h3 class="h6 fw-bold mb-1">Hover or tap</h3><p class="small wdw-muted mb-0">Opens on hover, toggles on tap.</p></div></div></div>
          <div class="col-md-4"><div class="d-flex gap-3 align-items-start p-3 wdw-card-sm h-100"><span class="wdw-icon"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="3" y="6" width="18" height="12" rx="2"/><path d="M7 10h.01M11 10h6M7 14h10"/></svg></span><div><h3 class="h6 fw-bold mb-1">Keyboard ready</h3><p class="small wdw-muted mb-0">Enter, Space and Esc just work.</p></div></div></div>
          <div class="col-md-4"><div class="d-flex gap-3 align-items-start p-3 wdw-card-sm h-100"><span class="wdw-icon"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M4 7h16M4 12h10M4 17h6"/></svg></span><div><h3 class="h6 fw-bold mb-1">Three levels deep</h3><p class="small wdw-muted mb-0">Nested submenus fold inline on mobile.</p></div></div></div>
        </div>
      </div>
    </div>
  </div>
</section>

Built on Bootstrap 5.3.8 with plain JavaScript — no jQuery. Supports light and dark mode via data-bs-theme.