Snippets Bar

Bootstrap 5 Navbar with Search Bar and Notifications

A storefront navbar with a rounded search field, category links with a dropdown, a notifications menu and a login button, collapsing to a stacked mobile layout.

Bootstrap 5 No jQuery Sep 2020 2.5K views

<section class="wdw-stage">
  <div class="container" style="max-width:1080px">
    <div class="wdw-card">
      <header class="shop-nav rounded-top-4">
        <div class="d-flex align-items-center gap-3 px-3 px-md-4 py-3">
          <a href="#" class="d-flex align-items-center gap-2 text-decoration-none fw-bold fs-5 text-body-emphasis me-md-2">
            <span class="wdw-icon" style="width:2.25rem;height:2.25rem;border-radius:.65rem" aria-hidden="true">
              <svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="4" width="18" height="12" rx="2"/><path d="M2 20h20"/></svg>
            </span>
            Lapstore
          </a>
          <form class="shop-search d-none d-md-block flex-grow-1" role="search" onsubmit="return false">
            <label for="shopSearch" class="visually-hidden">Search products</label>
            <div class="position-relative">
              <svg class="shop-search-icon" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><circle cx="11" cy="11" r="7"/><path d="m20 20-3.5-3.5"/></svg>
              <input id="shopSearch" type="search" class="form-control rounded-pill ps-5 bg-body-tertiary border-0" placeholder="Search laptops, phones, accessories" autocomplete="off">
              <kbd class="shop-kbd d-none d-lg-inline">/</kbd>
            </div>
          </form>
          <div class="d-flex align-items-center gap-2 ms-auto">
            <div class="dropdown">
              <button class="btn btn-icon rounded-circle position-relative" type="button" data-bs-toggle="dropdown" data-bs-auto-close="outside" aria-expanded="false" aria-label="Notifications, 3 new">
                <svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.85" stroke-linecap="round" stroke-linejoin="round"><path d="M6 8a6 6 0 1 1 12 0c0 7 3 9 3 9H3s3-2 3-9"/><path d="M10.3 21a1.9 1.9 0 0 0 3.4 0"/></svg>
                <span class="position-absolute top-0 end-0 mt-1 me-1 p-1 bg-danger rounded-circle shop-dot"></span>
              </button>
              <div class="dropdown-menu dropdown-menu-end p-2 shop-menu">
                <div class="px-3 pt-2 pb-1 wdw-eyebrow">Latest updates</div>
                <a class="dropdown-item d-flex gap-3 align-items-start rounded-3 py-2" href="#"><span class="wdw-icon"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M20 12v9H4v-9M2 7h20v5H2zM12 22V7M12 7H7.5a2.5 2.5 0 1 1 0-5C11 2 12 7 12 7zM12 7h4.5a2.5 2.5 0 1 0 0-5C13 2 12 7 12 7z"/></svg></span><span><span class="d-block fw-semibold">Your order has shipped</span><small class="text-body-secondary text-wrap">MacBook Air arrives Thursday</small></span></a>
                <a class="dropdown-item d-flex gap-3 align-items-start rounded-3 py-2" href="#"><span class="wdw-icon"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M20.6 13.4 13.4 20.6a2 2 0 0 1-2.8 0L2 12V2h10l8.6 8.6a2 2 0 0 1 0 2.8z"/><circle cx="7" cy="7" r="1.2"/></svg></span><span><span class="d-block fw-semibold">Price drop on your wishlist</span><small class="text-body-secondary text-wrap">ThinkPad X1 is now 15% off</small></span></a>
                <a class="dropdown-item d-flex gap-3 align-items-start rounded-3 py-2" href="#"><span class="wdw-icon"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="8" r="6"/><path d="m8.2 13.5-1.2 8.5 5-3 5 3-1.2-8.5"/></svg></span><span><span class="d-block fw-semibold">New reward unlocked</span><small class="text-body-secondary text-wrap">Free shipping for 30 days</small></span></a>
              </div>
            </div>
            <a href="#" class="btn btn-primary rounded-pill px-4">Log in</a>
          </div>
        </div>
        <nav class="navbar navbar-expand-md border-top px-3 px-md-4 py-0" aria-label="Shop categories">
          <form class="d-md-none w-100 my-2" role="search" onsubmit="return false">
            <label for="shopSearchM" class="visually-hidden">Search products</label>
            <input id="shopSearchM" type="search" class="form-control rounded-pill bg-body-tertiary border-0 px-4" placeholder="Search products">
          </form>
          <ul class="navbar-nav flex-row gap-1 py-2 shop-links">
            <li class="nav-item dropdown">
              <a class="nav-link dropdown-toggle rounded-pill px-3 active" href="#" data-bs-toggle="dropdown" data-bs-popper-config='{"strategy":"fixed"}' aria-expanded="false">Laptops</a>
              <ul class="dropdown-menu shop-menu p-2">
                <li><a class="dropdown-item rounded-3" href="#">Ultrabooks</a></li>
                <li><a class="dropdown-item rounded-3" href="#">Gaming</a></li>
                <li><a class="dropdown-item rounded-3" href="#">Workstations</a></li>
              </ul>
            </li>
            <li class="nav-item"><a class="nav-link rounded-pill px-3" href="#">Refurbished</a></li>
            <li class="nav-item"><a class="nav-link rounded-pill px-3" href="#">Accessories</a></li>
            <li class="nav-item"><a class="nav-link rounded-pill px-3" href="#">Blog</a></li>
            <li class="nav-item"><a class="nav-link rounded-pill px-3" href="#">Support</a></li>
          </ul>
        </nav>
      </header>
      <div class="p-3 p-md-4 bg-body-tertiary shop-body">
        <div class="row g-3">
          <div class="col-md-7"><div class="wdw-aurora rounded-4 p-4 p-md-5 h-100"><span class="badge text-bg-light rounded-pill mb-3">Autumn sale</span><h2 class="h3 fw-bold mb-2">Up to 30% off ultrabooks</h2><p class="mb-4 opacity-75">Certified refurbished and brand new, with free two-day shipping.</p><a href="#" class="btn btn-light rounded-pill px-4">Shop laptops</a></div></div>
          <div class="col-md-5 d-none d-md-block"><div class="wdw-card-sm p-3 h-100"><div class="wdw-eyebrow px-2 pt-1 pb-2">Featured this week</div><div class="d-flex flex-column gap-1"><a href="#" class="shop-pick d-flex align-items-center gap-3 text-decoration-none rounded-3 p-2"><span class="wdw-icon" aria-hidden="true"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="4" width="18" height="12" rx="2"/><path d="M2 20h20"/></svg></span><span class="flex-grow-1"><span class="d-block fw-semibold text-body-emphasis">MacBook Air 13</span><small class="text-body-secondary">M3 chip, 16 GB</small></span><span class="fw-semibold text-body-emphasis small">$999</span></a><a href="#" class="shop-pick d-flex align-items-center gap-3 text-decoration-none rounded-3 p-2"><span class="wdw-icon" aria-hidden="true"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="2" y="6" width="20" height="12" rx="3"/><path d="M6 12h4M8 10v4M15 11h.01M18 13h.01"/></svg></span><span class="flex-grow-1"><span class="d-block fw-semibold text-body-emphasis">Legion Pro 5</span><small class="text-body-secondary">RTX 4070, 165 Hz</small></span><span class="fw-semibold text-body-emphasis small">$1,499</span></a><a href="#" class="shop-pick d-flex align-items-center gap-3 text-decoration-none rounded-3 p-2"><span class="wdw-icon" aria-hidden="true"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="5" y="2" width="14" height="20" rx="3"/><path d="M11 18h2"/></svg></span><span class="flex-grow-1"><span class="d-block fw-semibold text-body-emphasis">Refurbished iPad Air</span><small class="text-body-secondary">Grade A, 1-year warranty</small></span><span class="fw-semibold text-body-emphasis small">$449</span></a></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.

Free to use in personal and commercial projects under the MIT license.