Check

Documentation and examples for Boosted Innovation Cup’s powerful, responsive navigation header, the navbar. Includes support for branding, navigation, and more, including support for our collapse plugin.

How it works

Here’s what you need to know before getting started with the navbar:

  • Navbars require a wrapping .navbar with .navbar-expand{-sm|-md|-lg|-xl|-xxl} for responsive collapsing and color scheme classes.
  • Navbars and their contents are fluid by default. Change the container to limit their horizontal width in different ways.
  • Use our spacing and flex utility classes for controlling spacing and alignment within navbars.
  • Navbars are responsive by default, but you can easily modify them to change that. Responsive behavior depends on our Collapse JavaScript plugin.
  • Ensure accessibility by using a <nav> element or, if using a more generic element such as a <div>, add a role="navigation" to every navbar to explicitly identify it as a landmark region for users of assistive technologies.
  • Indicate the current item by using aria-current="page" for the current page or aria-current="true" for the current item in a set.
  • Navbars can be themed with CSS variables that are scoped to the .navbar base class. .navbar-dark has been written to override CSS variables instead of adding additional styles.
The animation effect of this component is dependent on the prefers-reduced-motion media query. See the reduced motion section of our accessibility documentation.

Supported content

Navbars come with built-in support for a handful of sub-components. Choose from the following as needed:

  • .navbar-brand for Innovation Cup logo, and your product or project name.
  • .navbar-nav for a full-height and lightweight navigation (including support for dropdowns).
  • .navbar-toggler for use with our collapse plugin and other navigation toggling behaviors.
  • Flex and spacing utilities for any form controls and actions.
  • .navbar-text for adding vertically centered strings of text.
  • .collapse.navbar-collapse for grouping and hiding navbar contents by a parent breakpoint.
  • Add an optional .navbar-scroll to set a max-height and scroll expanded navbar content.

Here’s an example of all the sub-components included in a responsive dark-themed navbar that automatically collapses at the lg (large) breakpoint.

html
<nav class="navbar navbar-expand-lg navbar-dark bg-dark">
  <div class="container-fluid">
    <div class="navbar-brand">
      <a class="stretched-link" href="#">
        <img src="/innovation-cup/docs/0.2/assets/brand/boosted-innovation-cup-logo.png" width="50" height="50" alt="Boosted Innovation Cup" loading="lazy">
      </a>
    </div>
    <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
      <span class="navbar-toggler-icon"></span>
    </button>
    <div class="collapse navbar-collapse align-items-end" id="navbarSupportedContent">
      <ul class="navbar-nav me-auto">
        <li class="nav-item">
          <a class="nav-link active" aria-current="page" href="#">Home</a>
        </li>
        <li class="nav-item">
          <a class="nav-link" href="#">Link</a>
        </li>
        <li class="nav-item dropdown">
          <a class="nav-link dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown" aria-expanded="false">
            Dropdown
          </a>
          <ul class="dropdown-menu">
            <li><a class="dropdown-item" href="#">Action</a></li>
            <li><a class="dropdown-item" href="#">Another action</a></li>
            <li><hr class="dropdown-divider"></li>
            <li><a class="dropdown-item" href="#">Something else here</a></li>
          </ul>
        </li>
        <li class="nav-item">
          <a class="nav-link disabled">Disabled</a>
        </li>
      </ul>
      <form class="d-flex navbar-item ms-3" role="search">
        <input class="form-control me-2" type="search" placeholder="Search" aria-label="Search">
        <button class="btn btn-primary btn-inverse" type="submit">Search</button>
      </form>
    </div>
  </div>
</nav>

This example uses background (bg-dark) and spacing (me-auto, me-2, ms-3) utility classes.

Brand

The .navbar-brand can be used to contain most elements, but an anchor works best, as some elements might require utility classes or custom styles.

html
<!-- As a link -->
<header>
  <nav class="navbar navbar-dark bg-dark">
    <div class="container-fluid">
      <div class="navbar-brand">
        <a class="stretched-link" href="#">
          <img src="/innovation-cup/docs/0.2/assets/brand/boosted-innovation-cup-logo.png" width="50" height="50" alt="Boosted Innovation Cup " loading="lazy">
        </a>
        <h1 class="title">Navbar</h1>
      </div>
    </div>
  </nav>
</header>

<!-- As a heading -->
<header class="mt-3">
  <nav class="navbar navbar-dark bg-dark">
    <div class="container-fluid">
      <div class="navbar-brand">
        <span class="stretched-link">
          <img src="/innovation-cup/docs/0.2/assets/brand/boosted-innovation-cup-logo.png" width="50" height="50" alt="Boosted Innovation Cup " loading="lazy">
        </span>
        <h1 class="title">Navbar</h1>
      </div>
    </div>
  </nav>
</header>

Navbar navigation links build on our .nav options with their own modifier class and require the use of toggler classes for proper responsive styling. Navigation in navbars will also grow to occupy as much horizontal space as possible to keep your navbar contents securely aligned.

Add the .active class on .nav-link to indicate the current page.

Please note that you should also add the aria-current attribute on the active .nav-link.

html
<nav class="navbar navbar-expand-lg navbar-dark bg-dark">
  <div class="container-fluid">
    <div class="navbar-brand">
      <a class="stretched-link" href="#">
        <img src="/innovation-cup/docs/0.2/assets/brand/boosted-innovation-cup-logo.png" width="50" height="50" alt="Boosted Innovation Cup " loading="lazy">
      </a>
    </div>
    <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
      <span class="navbar-toggler-icon"></span>
    </button>
    <div class="collapse navbar-collapse" id="navbarNav">
      <ul class="navbar-nav">
        <li class="nav-item">
          <a class="nav-link active" aria-current="page" href="#">Home</a>
        </li>
        <li class="nav-item">
          <a class="nav-link" href="#">Features</a>
        </li>
        <li class="nav-item">
          <a class="nav-link" href="#">Pricing</a>
        </li>
        <li class="nav-item">
          <a class="nav-link disabled">Disabled</a>
        </li>
      </ul>
    </div>
  </div>
</nav>

And because we use classes for our navs, you can avoid the list-based approach entirely if you like.

html
<nav class="navbar navbar-expand-lg navbar-dark bg-dark">
  <div class="container-fluid">
    <div class="navbar-brand">
      <a class="stretched-link" href="#">
        <img src="/innovation-cup/docs/0.2/assets/brand/boosted-innovation-cup-logo.png" width="50" height="50" alt="Boosted Innovation Cup " loading="lazy">
      </a>
    </div>
    <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNavAltMarkup" aria-controls="navbarNavAltMarkup" aria-expanded="false" aria-label="Toggle navigation">
      <span class="navbar-toggler-icon"></span>
    </button>
    <div class="collapse navbar-collapse" id="navbarNavAltMarkup">
      <div class="navbar-nav">
        <a class="nav-link active" aria-current="page" href="#">Home</a>
        <a class="nav-link" href="#">Features</a>
        <a class="nav-link" href="#">Pricing</a>
        <a class="nav-link disabled">Disabled</a>
      </div>
    </div>
  </div>
</nav>

You can also use dropdowns in your navbar. Dropdown menus require a wrapping element for positioning, so be sure to use separate and nested elements for .nav-item and .nav-link as shown below.

html
<nav class="navbar navbar-expand-lg navbar-dark bg-dark">
  <div class="container-fluid">
    <div class="navbar-brand">
      <a class="stretched-link" href="#">
        <img src="/innovation-cup/docs/0.2/assets/brand/boosted-innovation-cup-logo.png" width="50" height="50" alt="Boosted Innovation Cup " loading="lazy">
      </a>
    </div>
    <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNavDropdown" aria-controls="navbarNavDropdown" aria-expanded="false" aria-label="Toggle navigation">
      <span class="navbar-toggler-icon"></span>
    </button>
    <div class="collapse navbar-collapse" id="navbarNavDropdown">
      <ul class="navbar-nav">
        <li class="nav-item">
          <a class="nav-link active" aria-current="page" href="#">Home</a>
        </li>
        <li class="nav-item">
          <a class="nav-link" href="#">Features</a>
        </li>
        <li class="nav-item">
          <a class="nav-link" href="#">Pricing</a>
        </li>
        <li class="nav-item dropdown">
          <a class="nav-link dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown" aria-expanded="false">
            Dropdown link
          </a>
          <ul class="dropdown-menu">
            <li><a class="dropdown-item" href="#">Action</a></li>
            <li><a class="dropdown-item" href="#">Another action</a></li>
            <li><a class="dropdown-item" href="#">Something else here</a></li>
          </ul>
        </li>
      </ul>
    </div>
  </div>
</nav>

Forms

Place various form controls and components within a navbar:

html
<nav class="navbar navbar-dark bg-dark">
  <div class="container-fluid">
    <form class="d-flex" role="search">
      <input class="form-control me-2" type="search" placeholder="Search" aria-label="Search">
      <button class="btn btn-primary btn-inverse" type="submit">Search</button>
    </form>
  </div>
</nav>

Immediate child elements of .navbar use flex layout. Use additional flex utilities as needed to adjust this behavior.

html
<nav class="navbar navbar-dark bg-dark">
  <div class="container-fluid">
    <div class="navbar-brand me-auto">
      <a class="stretched-link" href="#">
        <img src="/innovation-cup/docs/0.2/assets/brand/boosted-innovation-cup-logo.png" width="50" height="50" alt="Boosted Innovation Cup " loading="lazy">
      </a>
    </div>
    <form class="d-flex navbar-item" role="search">
      <input class="form-control me-2" type="search" placeholder="Search" aria-label="Search">
      <button class="btn btn-primary btn-inverse" type="submit">Search</button>
    </form>
  </div>
</nav>

Input groups work, too. If your navbar is an entire form, or mostly a form, you can use the <form> element as the container and save some HTML. Applies to the option above and below this copy.

html
<nav class="navbar navbar-dark bg-dark">
  <form class="container-fluid">
    <div class="input-group">
      <span class="input-group-text" id="basic-addon1">@</span>
      <input type="text" class="form-control" placeholder="Username" aria-label="Username" aria-describedby="basic-addon1">
    </div>
  </form>
</nav>

Various buttons are supported as part of these navbar forms, too. This is also a great reminder that vertical alignment utilities can be used to align different sized elements.

html
<nav class="navbar navbar-dark bg-dark">
  <form class="container-fluid justify-content-start align-items-center">
    <button class="btn btn-primary btn-inverse me-2" type="button">Main button</button>
    <button class="btn btn-sm btn-primary btn-inverse" type="button">Smaller button</button>
  </form>
</nav>

Text

Navbars may contain bits of text with the help of .navbar-text. This class adjusts vertical alignment and horizontal spacing for strings of text.

html
<nav class="navbar navbar-dark bg-dark">
  <div class="container-fluid">
    <span class="navbar-text">
      Navbar text with an inline element
    </span>
  </div>
</nav>

Mix and match with other components and utilities as needed.

html
<nav class="navbar navbar-expand-lg navbar-dark bg-dark">
  <div class="container-fluid">
    <div class="navbar-brand">
      <a class="stretched-link" href="#">
        <img src="/innovation-cup/docs/0.2/assets/brand/boosted-innovation-cup-logo.png" width="50" height="50" alt="Boosted Innovation Cup " loading="lazy">
      </a>
    </div>
    <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarText" aria-controls="navbarText" aria-expanded="false" aria-label="Toggle navigation">
      <span class="navbar-toggler-icon"></span>
    </button>
    <div class="collapse navbar-collapse align-items-end" id="navbarText">
      <ul class="navbar-nav me-auto mb-2 mb-lg-0">
        <li class="nav-item">
          <a class="nav-link active" aria-current="page" href="#">Home</a>
        </li>
        <li class="nav-item">
          <a class="nav-link" href="#">Features</a>
        </li>
        <li class="nav-item">
          <a class="nav-link" href="#">Pricing</a>
        </li>
      </ul>
      <span class="navbar-text ms-3">
        Navbar text with an inline element
      </span>
    </div>
  </div>
</nav>

Color schemes

Navbar theming is powered by CSS variables. CSS variables are applied to .navbar, defaulting to the “light” appearance, and can be overridden with .navbar-dark.

Navbar themes are easier than ever thanks to Boosted Innovation Cup’s combination of Sass and CSS variables. The default is our “light navbar” for use with light background colors, you can also apply .navbar-dark for dark background colors. Then, customize with .bg-* utilities.

You will mostly find examples using a combination of .navbar-dark and .bg-dark for consistency.

Containers

Although it’s not required, you can wrap a navbar in a .container to center it on a pageโ€“though note that an inner container is still required. Or you can add a container inside the .navbar to only center the contents of a fixed or static top navbar.

html
<div class="container">
  <nav class="navbar navbar-expand-lg navbar-dark bg-dark">
    <div class="container-fluid">
      <div class="navbar-brand">
        <a class="stretched-link" href="#">
          <img src="/innovation-cup/docs/0.2/assets/brand/boosted-innovation-cup-logo.png" width="50" height="50" alt="Boosted Innovation Cup " loading="lazy">
        </a>
      </div>
    </div>
  </nav>
</div>

Use any of the responsive containers to change how wide the content in your navbar is presented.

html
<nav class="navbar navbar-expand-lg navbar-dark bg-dark">
  <div class="container-md">
    <div class="navbar-brand">
      <a class="stretched-link" href="#">
        <img src="/innovation-cup/docs/0.2/assets/brand/boosted-innovation-cup-logo.png" width="50" height="50" alt="Boosted Innovation Cup " loading="lazy">
      </a>
    </div>
  </div>
</nav>

Placement

Use our position utilities to place navbars in non-static positions. Choose from fixed to the top, fixed to the bottom, stickied to the top (scrolls with the page until it reaches the top, then stays there), or stickied to the bottom (scrolls with the page until it reaches the bottom, then stays there).

Fixed navbars use position: fixed, meaning they’re pulled from the normal flow of the DOM and may require custom CSS (e.g., padding-top on the <body>) to prevent overlap with other elements.

html
<nav class="navbar navbar-dark bg-dark">
  <div class="container-fluid">
    <div class="navbar-brand">
      <a class="stretched-link" href="#">
        <img src="/innovation-cup/docs/0.2/assets/brand/boosted-innovation-cup-logo.png" width="50" height="50" alt="Boosted Innovation Cup " loading="lazy">
      </a>
      <h1 class="title">Default</h1>
    </div>
  </div>
</nav>
html
<nav class="navbar fixed-top navbar-dark bg-dark">
  <div class="container-fluid">
    <div class="navbar-brand">
      <a class="stretched-link" href="#">
        <img src="/innovation-cup/docs/0.2/assets/brand/boosted-innovation-cup-logo.png" width="50" height="50" alt="Boosted Innovation Cup " loading="lazy">
      </a>
      <h1 class="title">Fixed top</h1>
    </div>
  </div>
</nav>
html
<nav class="navbar fixed-bottom navbar-dark bg-dark">
  <div class="container-fluid">
    <div class="navbar-brand">
      <a class="stretched-link" href="#">
        <img src="/innovation-cup/docs/0.2/assets/brand/boosted-innovation-cup-logo.png" width="50" height="50" alt="Boosted Innovation Cup " loading="lazy">
      </a>
      <h1 class="title">Fixed bottom</h1>
    </div>
  </div>
</nav>
html
<nav class="navbar sticky-top navbar-dark bg-dark">
  <div class="container-fluid">
    <div class="navbar-brand">
      <a class="stretched-link" href="#">
        <img src="/innovation-cup/docs/0.2/assets/brand/boosted-innovation-cup-logo.png" width="50" height="50" alt="Boosted Innovation Cup " loading="lazy">
      </a>
      <h1 class="title">Sticky top</h1>
    </div>
  </div>
</nav>
html
<nav class="navbar sticky-bottom navbar-dark bg-dark">
  <div class="container-fluid">
    <div class="navbar-brand">
      <a class="stretched-link" href="#">
        <img src="/innovation-cup/docs/0.2/assets/brand/boosted-innovation-cup-logo.png" width="50" height="50" alt="Boosted Innovation Cup " loading="lazy">
      </a>
      <h1 class="title">Sticky bottom</h1>
    </div>
  </div>
</nav>

Scrolling

Add .navbar-nav-scroll to a .navbar-nav (or other navbar sub-component) to enable vertical scrolling within the toggleable contents of a collapsed navbar. By default, scrolling kicks in at 75vh (or 75% of the viewport height), but you can override that with the local CSS custom property --bs-navbar-height or custom styles. At larger viewports when the navbar is expanded, content will appear as it does in a default navbar.

Please note that this behavior comes with a potential drawback of overflowโ€”when setting overflow-y: auto (required to scroll the content here), overflow-x is the equivalent of auto, which will crop some horizontal content.

Here’s an example navbar using .navbar-nav-scroll with style="--bs-scroll-height: 100px;", with some extra margin utilities for optimum spacing.

html
<nav class="navbar navbar-expand-lg navbar-dark bg-dark">
  <div class="container-fluid">
    <div class="navbar-brand">
      <a class="stretched-link" href="#" aria-label="Back to home"></a>
      <h1 class="title">Scroll</h1>
    </div>
    <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarScroll" aria-controls="navbarScroll" aria-expanded="false" aria-label="Toggle navigation">
      <span class="navbar-toggler-icon"></span>
    </button>
    <div class="collapse navbar-collapse align-items-end" id="navbarScroll">
      <ul class="navbar-nav me-auto my-2 my-lg-0 navbar-nav-scroll align-items-end" style="--bs-scroll-height: 100px;">
        <li class="nav-item">
          <a class="nav-link active" aria-current="page" href="#">Home</a>
        </li>
        <li class="nav-item">
          <a class="nav-link" href="#">Link</a>
        </li>
        <li class="nav-item dropdown">
          <a class="nav-link dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown" aria-expanded="false">
            Link
          </a>
          <ul class="dropdown-menu">
            <li><a class="dropdown-item" href="#">Action</a></li>
            <li><a class="dropdown-item" href="#">Another action</a></li>
            <li><hr class="dropdown-divider"></li>
            <li><a class="dropdown-item" href="#">Something else here</a></li>
          </ul>
        </li>
      </ul>
      <form class="d-flex navbar-item ms-3 mt-md-4" role="search">
        <input class="form-control me-2" type="search" placeholder="Search" aria-label="Search">
        <button class="btn btn-primary btn-inverse" type="submit">Search</button>
      </form>
    </div>
  </div>
</nav>

Responsive behaviors

Navbars can use .navbar-toggler, .navbar-collapse, and .navbar-expand{-sm|-md|-lg|-xl|-xxl} classes to determine when their content collapses behind a button. In combination with other utilities, you can easily choose when to show or hide particular elements.

For navbars that never collapse, add the .navbar-expand class on the navbar. For navbars that always collapse, don’t add any .navbar-expand class.

External content

Sometimes you want to use the collapse plugin to trigger a container element for content that structurally sits outside of the .navbar . Because our plugin works on the id and data-bs-target matching, that’s easily done!

html
<div class="collapse" id="navbarToggleExternalContent">
  <div class="bg-dark p-4">
    <h5 class="text-white h4">Collapsed content</h5>
    <span class="text-muted">Toggleable via the navbar brand.</span>
  </div>
</div>
<nav class="navbar navbar-dark bg-dark">
  <div class="container-fluid">
    <button class="navbar-toggler ms-auto" type="button" data-bs-toggle="collapse" data-bs-target="#navbarToggleExternalContent" aria-controls="navbarToggleExternalContent" aria-expanded="false" aria-label="Toggle navigation">
      <span class="navbar-toggler-icon"></span>
    </button>
  </div>
</nav>

When you do this, we recommend including additional JavaScript to move the focus programmatically to the container when it is opened. Otherwise, keyboard users and users of assistive technologies will likely have a hard time finding the newly revealed content - particularly if the container that was opened comes before the toggler in the document’s structure. We also recommend making sure that the toggler has the aria-controls attribute, pointing to the id of the content container. In theory, this allows assistive technology users to jump directly from the toggler to the container it controlsโ€“but support for this is currently quite patchy.

Offcanvas

Transform your expanding and collapsing navbar into an offcanvas drawer with the offcanvas component. We extend both the offcanvas default styles and use our .navbar-expand-* classes to create a dynamic and flexible navigation sidebar.

In the example below, to create an offcanvas navbar that is always collapsed across all breakpoints, omit the .navbar-expand-* class entirely.

html
<nav class="navbar fixed-top">
  <div class="container-fluid">
    <button class="navbar-toggler ms-auto" type="button" data-bs-toggle="offcanvas" data-bs-target="#offcanvasNavbar" aria-controls="offcanvasNavbar" aria-expanded="false" aria-label="Toggle navigation">
      <span class="navbar-toggler-icon"></span>
    </button>
    <div class="offcanvas offcanvas-end" tabindex="-1" id="offcanvasNavbar" aria-labelledby="offcanvasNavbarLabel">
      <div class="offcanvas-header">
        <h5 class="offcanvas-title" id="offcanvasNavbarLabel">Offcanvas</h5>
        <button type="button" class="btn-close" data-bs-dismiss="offcanvas" aria-label="Close"></button>
      </div>
      <div class="offcanvas-body">
        <ul class="navbar-nav justify-content-end flex-grow-1 pe-3 mb-3">
          <li class="nav-item">
            <a class="nav-link active" aria-current="page" href="#">Home</a>
          </li>
          <li class="nav-item">
            <a class="nav-link" href="#">Link</a>
          </li>
          <li class="nav-item dropdown">
            <a class="nav-link dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown" aria-expanded="false">
              Dropdown
            </a>
            <ul class="dropdown-menu">
              <li><a class="dropdown-item" href="#">Action</a></li>
              <li><a class="dropdown-item" href="#">Another action</a></li>
              <li>
                <hr class="dropdown-divider">
              </li>
              <li><a class="dropdown-item" href="#">Something else here</a></li>
            </ul>
          </li>
        </ul>
        <form class="d-flex" role="search">
          <input class="form-control me-2" type="search" placeholder="Search" aria-label="Search">
          <button class="btn btn-primary" type="submit">Search</button>
        </form>
      </div>
    </div>
  </div>
</nav>

To create an offcanvas navbar that expands into a normal navbar at a specific breakpoint like lg, use .navbar-expand-lg.

<nav class="navbar navbar-expand-lg fixed-top">
  <button class="navbar-toggler ms-auto" type="button" data-bs-toggle="offcanvas" data-bs-target="#navbarOffcanvasLg" aria-controls="navbarOffcanvasLg" aria-expanded="false" aria-label="Toggle navigation">
    <span class="navbar-toggler-icon"></span>
  </button>
  <div class="offcanvas offcanvas-end" tabindex="-1" id="navbarOffcanvasLg" aria-labelledby="navbarOffcanvasLgLabel">
    ...
  </div>
</nav>

When using offcanvas in a dark navbar, be aware that you may need to have a dark background on the offcanvas content to avoid the text becoming illegible. In the example below, we add .navbar-dark and .bg-dark to the .navbar, .text-bg-dark to the .offcanvas, .dropdown-menu-dark to .dropdown-menu, and .btn-close-white to .btn-close for proper styling with a dark offcanvas.

html
<nav class="navbar navbar-dark bg-dark fixed-top">
  <div class="container-fluid">
    <a class="navbar-brand" href="#">Offcanvas dark navbar</a>
    <button class="navbar-toggler ms-auto" type="button" data-bs-toggle="offcanvas" data-bs-target="#offcanvasDarkNavbar" aria-controls="offcanvasDarkNavbar" aria-expanded="false" aria-label="Toggle navigation">
      <span class="navbar-toggler-icon"></span>
    </button>
    <div class="offcanvas offcanvas-end text-bg-dark" tabindex="-1" id="offcanvasDarkNavbar" aria-labelledby="offcanvasDarkNavbarLabel">
      <div class="offcanvas-header">
        <h5 class="offcanvas-title" id="offcanvasDarkNavbarLabel">Dark offcanvas</h5>
        <button type="button" class="btn-close btn-close-white" data-bs-dismiss="offcanvas" aria-label="Close"></button>
      </div>
      <div class="offcanvas-body">
        <ul class="navbar-nav justify-content-end flex-grow-1 pe-3 mb-3">
          <li class="nav-item">
            <a class="nav-link active" aria-current="page" href="#">Home</a>
          </li>
          <li class="nav-item">
            <a class="nav-link" href="#">Link</a>
          </li>
          <li class="nav-item dropdown">
            <a class="nav-link dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown" aria-expanded="false">
              Dropdown
            </a>
            <ul class="dropdown-menu dropdown-menu-dark">
              <li><a class="dropdown-item" href="#">Action</a></li>
              <li><a class="dropdown-item" href="#">Another action</a></li>
              <li>
                <hr class="dropdown-divider">
              </li>
              <li><a class="dropdown-item" href="#">Something else here</a></li>
            </ul>
          </li>
        </ul>
        <form class="d-flex" role="search">
          <input class="form-control me-2" type="search" placeholder="Search" aria-label="Search">
          <button class="btn btn btn-primary btn-inverse" type="submit">Search</button>
        </form>
      </div>
    </div>
  </div>
</nav>

CSS

Variables

As part Boosted Innovation Cup’s evolving CSS variables approach, navbars now use local CSS variables on .navbar for enhanced real-time customization. Values for the CSS variables are set via Sass, so Sass customization is still supported, too.

  --#{$prefix}navbar-padding-x: #{if($navbar-padding-x == null, 0, $navbar-padding-x)};
  --#{$prefix}navbar-padding-y: 0; // Boosted mod: no padding in small breakpoints
  --#{$prefix}navbar-font-weight: #{$navbar-font-weight}; // Boosted mod
  --#{$prefix}navbar-border-width: #{$navbar-border-width}; // Boosted mod
  --#{$prefix}navbar-border-color: #{$navbar-border-color}; // Boosted mod
  --#{$prefix}navbar-color: #{$navbar-light-color};
  --#{$prefix}navbar-hover-color: #{$navbar-light-hover-color};
  --#{$prefix}navbar-disabled-color: #{$navbar-light-disabled-color};
  --#{$prefix}navbar-active-color: #{$navbar-light-active-color};
  --#{$prefix}navbar-brand-padding-y: #{$navbar-brand-padding-y};
  --#{$prefix}navbar-brand-margin-y: #{$navbar-brand-margin-y-xs}; // Boosted mod
  --#{$prefix}navbar-brand-margin-end: #{$navbar-brand-margin-end};
  --#{$prefix}navbar-brand-logo-size: #{$navbar-brand-logo-size-xs}; // Boosted mod
  --#{$prefix}navbar-brand-font-size: #{$navbar-brand-font-size-xs}; // Boosted mod
  --#{$prefix}navbar-brand-letter-spacing: #{$navbar-brand-letter-spacing-xs}; // Boosted mod
  --#{$prefix}navbar-brand-color: #{$navbar-light-brand-color};
  --#{$prefix}navbar-brand-hover-color: #{$navbar-light-brand-hover-color};
  --#{$prefix}navbar-nav-padding-top: 0; // Boosted mod
  --#{$prefix}navbar-nav-padding-x: 0; // Boosted mod
  --#{$prefix}navbar-nav-padding-bottom: 0; // Boosted mod
  --#{$prefix}navbar-nav-font-size: #{$font-size-base}; // Boosted mod
  --#{$prefix}navbar-nav-line-height: #{$line-height-base}; // Boosted mod
  --#{$prefix}navbar-nav-letter-spacing: #{$letter-spacing-base}; // Boosted mod
  --#{$prefix}navbar-nav-link-padding-y: #{$navbar-nav-link-padding-y}; // Boosted mod
  --#{$prefix}navbar-nav-link-padding-x: #{$navbar-nav-link-padding-x-xs}; // Boosted mod
  --#{$prefix}navbar-nav-icon-padding-y: #{$navbar-nav-icon-padding-y-xs}; // Boosted mod
  --#{$prefix}navbar-nav-icon-padding-x: #{$navbar-nav-icon-padding-x-xs}; // Boosted mod
  --#{$prefix}navbar-nav-icon-size: #{$navbar-icon-size-xs}; // Boosted mod
  --#{$prefix}navbar-toggler-padding-y: #{$navbar-toggler-padding-y};
  --#{$prefix}navbar-toggler-padding-x: #{$navbar-toggler-padding-x};
  --#{$prefix}navbar-toggler-font-size: #{$navbar-toggler-font-size-xs}; // Boosted mod
  --#{$prefix}navbar-toggler-icon-bg: #{escape-svg($navbar-light-toggler-icon-bg-small)}; // Boosted mod
  --#{$prefix}navbar-toggler-icon-filter: none; // Boosted mod
  --#{$prefix}navbar-toggler-border-color: #{$navbar-light-toggler-border-color};
  --#{$prefix}navbar-toggler-border-radius: #{$navbar-toggler-border-radius};
  --#{$prefix}navbar-toggler-focus-width: #{$navbar-toggler-focus-width};
  --#{$prefix}navbar-toggler-transition: #{$navbar-toggler-transition};
  

Some additional CSS variables are also present on .navbar-nav:

  --#{$prefix}nav-link-padding-x: var(--#{$prefix}navbar-nav-link-padding-x); // Boosted mod
  --#{$prefix}nav-link-padding-y: var(--#{$prefix}navbar-nav-link-padding-y); // Boosted mod
  @include rfs(var(--#{$prefix}navbar-nav-font-size, $font-size-base), --#{$prefix}nav-link-font-size); // Boosted mod
  --#{$prefix}nav-link-font-weight: #{$nav-link-font-weight};
  --#{$prefix}nav-link-color: var(--#{$prefix}navbar-color);
  --#{$prefix}nav-link-hover-color: var(--#{$prefix}navbar-hover-color);
  --#{$prefix}nav-link-disabled-color: var(--#{$prefix}navbar-disabled-color);
  

Customization through CSS variables can be seen on the .navbar-dark class where we override specific values without adding duplicate CSS selectors.

  --#{$prefix}navbar-border-color: #{$navbar-dark-border-color}; // Boosted mod
  --#{$prefix}navbar-color: #{$navbar-dark-color};
  --#{$prefix}navbar-hover-color: #{$navbar-dark-hover-color};
  --#{$prefix}navbar-disabled-color: #{$navbar-dark-disabled-color};
  --#{$prefix}navbar-active-color: #{$navbar-dark-active-color};
  --#{$prefix}navbar-brand-color: #{$navbar-dark-brand-color};
  --#{$prefix}navbar-brand-hover-color: #{$navbar-dark-brand-hover-color};
  --#{$prefix}navbar-toggler-border-color: #{$navbar-dark-toggler-border-color};
  // Boosted mod: No --#{$prefix}navbar-toggler-icon-bg: #{escape-svg($navbar-dark-toggler-icon-bg)}; since we handle the variant with filter
  --#{$prefix}navbar-toggler-icon-filter: #{$invert-filter}; // Boosted mod
  

Sass variables

Variables for all navbars:

$navbar-padding-y:                    .375rem; // Boosted mod
$navbar-padding-x:                    null;
$navbar-font-weight:                  $font-weight-bold; // Boosted mod

$navbar-nav-link-padding-y:           1rem; // Boosted mod
$navbar-nav-link-padding-x-xs:        $spacer * .25; // Boosted mod
$navbar-nav-link-padding-x:           $spacer * .5; // Boosted mod

$navbar-brand-font-size:              2.1875rem; // Boosted mod
// Boosted mod: no nav-link-height calculation
$navbar-brand-padding-y:              0; // Boosted mod
$navbar-brand-margin-end:             $spacer * 1.5; // Boosted mod

$navbar-toggler-icon-close-bg:        $cross-icon; // Boosted mod
$navbar-toggler-padding-y:            $spacer * .6; // Boosted mod: same as $navbar-nav-icon-padding-y-xs
$navbar-toggler-padding-x:            $spacer * .75; // Boosted mod: same as $navbar-nav-icon-padding-x-xs
$navbar-toggler-font-size-xs:         1.04166666rem; // Boosted mod
$navbar-toggler-font-size:            1.25rem; // Boosted mod
$navbar-toggler-border-radius:        $btn-border-radius;
$navbar-toggler-focus-width:          null; // Boosted mod
$navbar-toggler-transition:           $transition-focus; // Boosted mod

$navbar-light-color:                  $black;
$navbar-light-hover-color:            $accessible-orange;
$navbar-light-active-color:           $accessible-orange;
$navbar-light-disabled-color:         $gray-500;
$navbar-light-toggler-icon-bg:        $burger-icon;
$navbar-light-toggler-icon-bg-small:  $burger-icon-small; // Boosted mod: slightly different burger icon for small breakpoints
$navbar-light-toggler-border-color:   null;
$navbar-light-brand-color:            $navbar-light-active-color;
$navbar-light-brand-hover-color:      $navbar-light-active-color;

Variables for the dark navbar:

$navbar-dark-border-color:          $gray-700;
$navbar-dark-color:                 $white;
$navbar-dark-hover-color:           $primary;
$navbar-dark-active-color:          $primary;
$navbar-dark-disabled-color:        $gray-400;
$navbar-dark-toggler-border-color:  transparent;
// Boosted mod: no $navbar-dark-toggler-icon-bg since dark toggler are handled with filter
$navbar-dark-brand-color:           inherit;
$navbar-dark-brand-hover-color:     $navbar-dark-active-color;

Sass loop

Responsive navbar expand/collapse classes (e.g., .navbar-expand-lg) are combined with the $breakpoints map and generated through a loop in scss/_navbar.scss.

// Generate series of `.navbar-expand-*` responsive classes for configuring
// where your navbar collapses.
.navbar-expand {
  @each $breakpoint in map-keys($grid-breakpoints) {
    $next: breakpoint-next($breakpoint, $grid-breakpoints);
    $infix: breakpoint-infix($next, $grid-breakpoints);

    // stylelint-disable-next-line scss/selector-no-union-class-name
    &#{$infix} {
      @include media-breakpoint-up($next) {
        flex-wrap: nowrap;
        justify-content: flex-start;

        .navbar-nav {
          flex-direction: row;

          .dropdown-menu {
            position: absolute;
          }

          // Boosted mod
          .nav-link {
            margin-left: 0;

            &.active::before {
              position: absolute;
              right: var(--#{$prefix}navbar-nav-link-padding-x);
              bottom: calc(-1 * var(--#{$prefix}navbar-padding-y)); // stylelint-disable-line function-disallowed-list
              left: var(--#{$prefix}navbar-nav-link-padding-x);
              height: calc(var(--#{$prefix}navbar-border-width) * 4); // stylelint-disable-line function-disallowed-list
              content: "";
              background-color: currentcolor;
              @include transition($navbar-active-transition);
            }
          }

          .nav-item {
            border: 0;

            &:first-child > .nav-link {
              margin-left: calc(-1 * var(--#{$prefix}navbar-nav-link-padding-x)); /* stylelint-disable-line function-disallowed-list */
            }

            &:last-child > .nav-link {
              margin-right: calc(-1 * var(--#{$prefix}navbar-nav-link-padding-x)); /* stylelint-disable-line function-disallowed-list */
            }

            &:first-child > .nav-icon {
              margin-left: calc(-1 * var(--#{$prefix}navbar-nav-icon-padding-x)); /* stylelint-disable-line function-disallowed-list */
            }

            &:last-child > .nav-icon {
              margin-right: calc(-1 * var(--#{$prefix}navbar-nav-icon-padding-x)); /* stylelint-disable-line function-disallowed-list */
            }
          }
          // End mod
        }

        // Boosted mod: Handle the responsiveness of the collapsing content in a global header
        .navbar-collapse.show,
        .navbar-collapse.collapsing {
          &[class*="d-"] {
            margin-bottom: 0;
            border-top: 0;
          }

          &:first-of-type {
            margin-top: 0;
          }
        }

        // Handle the responsiveness of the different bars of a global header
        &.supra {
          display: flex;
        }

        &.header-minimized {
          --#{$prefix}navbar-nav-link-padding-y: .75rem;
        }

        &:not(.supra) + .navbar {
          margin-top: 0;

          .nav-link{
            padding-bottom: add(var(--#{$prefix}navbar-nav-link-padding-y), .0625rem);

            &.active::before{
              bottom: 0;
            }
          }
        }
        // End mod

        .navbar-nav-scroll {
          overflow: visible;
        }

        .navbar-collapse {
          display: flex !important; // stylelint-disable-line declaration-no-important
          flex-basis: auto;
        }

        .navbar-toggler {
          display: none;
        }

        .offcanvas {
          // stylelint-disable declaration-no-important
          position: static;
          z-index: auto;
          flex-grow: 1;
          width: auto !important;
          height: auto !important;
          visibility: visible !important;
          background-color: transparent !important;
          border: 0 !important;
          transform: none !important;
          @include box-shadow(none);
          @include transition(none);
          // stylelint-enable declaration-no-important

          .offcanvas-header {
            display: none;
          }

          .offcanvas-body {
            display: flex;
            flex-grow: 0;
            padding: 0;
            overflow-y: visible;
          }
        }
      }
    }
  }
}