Angular Bootstrap navbar

Angular Navbar - Bootstrap 4 & Material Design

Note: This documentation is for an older version of Bootstrap (v.4). A newer version is available for Bootstrap 5. We recommend migrating to the latest version of our product - Material Design for Bootstrap 5.
Go to docs v.5

Angular Bootstrap navbar is a simple wrapper for positioning branding, navigation, and other elements into a concise navigation header. It’s easily extensible and, with the help of our collapse plugin, it can easily integrate offscreen content.

MDB provides you with stylish Navbars, with distinctive for Material Design details (such as shadows, living colors or charming wave effects triggered by clicking on the link). Apart from traditional, text links, Bootstraps Navbar might embed regular & social icons, dropdowns, avatars or search forms.

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} for responsive collapsing and color scheme classes.

  • Navbars and their contents are fluid by default. Use optional containers to limit their horizontal width.

  • Navbars and their contents are built with flexbox, providing easy alignment options via utility classes.

  • 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.

Read on for an example and list of supported sub-components.


Basic example

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

        
            
          <!--Navbar-->
          <mdb-navbar SideClass="navbar navbar-expand-lg navbar-dark indigo">

            <!-- Navbar brand -->
            <mdb-navbar-brand><a class="navbar-brand" href="#">Navbar</a></mdb-navbar-brand>

            <!-- Collapsible content -->
            <links>

              <!-- Links -->
              <ul class="navbar-nav mr-auto">
                <li class="nav-item active">
                  <a class="nav-link waves-light" mdbWavesEffect>Home<span class="sr-only">(current)</span></a>
                </li>
                <li class="nav-item">
                  <a class="nav-link waves-light" mdbWavesEffect>Features</a>
                </li>
                <li class="nav-item">
                  <a class="nav-link waves-light" mdbWavesEffect>Pricing</a>
                </li>

                <!-- Dropdown -->
                <li class="nav-item dropdown" dropdown>
                  <a dropdownToggle mdbWavesEffect type="button" class="nav-link dropdown-toggle waves-light" mdbWavesEffect>
                    Basic dropdown<span class="caret"></span>
                  </a>
                  <div *dropdownMenu class="dropdown-menu dropdown dropdown-primary" role="menu">
                    <a class="dropdown-item waves-light" mdbWavesEffect href="#">Action</a>
                    <a class="dropdown-item waves-light" mdbWavesEffect href="#">Another action</a>
                    <a class="dropdown-item waves-light" mdbWavesEffect href="#">Something else here</a>
                    <div class="divider dropdown-divider"></div>
                    <a class="dropdown-item waves-light" mdbWavesEffect href="#">Separated link</a>
                  </div>
                </li>
              </ul>
              <!-- Links -->

              <!-- Search form -->
              <form class="form-inline waves-light" mdbWavesEffect>
                <div class="md-form my-0">
                  <input class="form-control mr-sm-2" type="text" placeholder="Search">
                </div>
              </form>
            </links>
            <!-- Collapsible content -->

          </mdb-navbar>
          <!--/.Navbar-->
        
        
    

Navbar with search bar

        
            
            <!--Navbar-->
            <mdb-navbar SideClass="navbar navbar-expand-lg navbar-dark bg-primary" [containerInside]="false">

              <!-- Navbar brand -->
              <mdb-navbar-brand><a class="navbar-brand" href="#">Navbar</a></mdb-navbar-brand>

              <!-- Collapsible content -->
              <links>

                <!-- Links -->
                <ul class="navbar-nav mr-auto">
                  <li class="nav-item active">
                    <a class="nav-link waves-light" mdbWavesEffect>Home<span class="sr-only">(current)</span></a>
                  </li>
                  <li class="nav-item">
                    <a class="nav-link waves-light" mdbWavesEffect>Features</a>
                  </li>
                  <li class="nav-item">
                    <a class="nav-link waves-light" mdbWavesEffect>Pricing</a>
                  </li>

                  <!-- Dropdown -->
                  <li class="nav-item dropdown" dropdown>
                    <a dropdownToggle mdbWavesEffect type="button" class="nav-link dropdown-toggle waves-light" mdbWavesEffect>
                      Basic dropdown<span class="caret"></span></a>
                    <div *dropdownMenu class="dropdown-menu dropdown dropdown-primary" role="menu">
                      <a class="dropdown-item waves-light" mdbWavesEffect href="#">Action</a>
                      <a class="dropdown-item waves-light" mdbWavesEffect href="#">Another action</a>
                      <a class="dropdown-item waves-light" mdbWavesEffect href="#">Something else here</a>
                      <div class="divider dropdown-divider"></div>
                      <a class="dropdown-item waves-light" mdbWavesEffect href="#">Separated link</a>
                    </div>
                  </li>

                </ul>
                <!-- Links -->

                <!-- Search form -->
                <form class="form-inline waves-light" mdbWavesEffect>
                  <div class="md-form my-0">
                    <input class="form-control mr-sm-2" type="text" placeholder="Search">
                  </div>
                </form>
              </links>
              <!-- Collapsible content -->

            </mdb-navbar>
            <!--/.Navbar-->
          
        
    

Navbar with icons

        
            
            <!--Navbar-->
            <mdb-navbar SideClass="navbar navbar-expand-lg navbar-dark unique-color" [containerInside]="false">

              <!-- Navbar brand -->
              <mdb-navbar-brand><a class="navbar-brand" href="#">Navbar</a></mdb-navbar-brand>

              <!-- Collapsible content -->
              <links>

                <!-- Links -->
                <ul class="navbar-nav mr-auto">
                  <li class="nav-item active">
                    <a class="nav-link waves-light" mdbWavesEffect>Home<span class="sr-only">(current)</span></a>
                  </li>
                  <li class="nav-item">
                    <a class="nav-link waves-light" mdbWavesEffect>Features</a>
                  </li>
                  <li class="nav-item">
                    <a class="nav-link waves-light" mdbWavesEffect>Pricing</a>
                  </li>

                  <!-- Dropdown -->
                  <li class="nav-item dropdown" dropdown>
                    <a dropdownToggle mdbWavesEffect type="button" class="nav-link dropdown-toggle waves-light" mdbWavesEffect>
                      Basic dropdown<span class="caret"></span></a>
                    <div *dropdownMenu class="dropdown-menu dropdown dropdown-primary" role="menu">
                      <a class="dropdown-item waves-light" mdbWavesEffect href="#">Action</a>
                      <a class="dropdown-item waves-light" mdbWavesEffect href="#">Another action</a>
                      <a class="dropdown-item waves-light" mdbWavesEffect href="#">Something else here</a>
                      <div class="divider dropdown-divider"></div>
                      <a class="dropdown-item waves-light" mdbWavesEffect href="#">Separated link</a>
                    </div>
                  </li>

                </ul>
                <!-- Links -->

                <ul class="navbar-nav ml-auto nav-flex-icons">
                  <li class="nav-item">
                    <a class="nav-link">
                      <mdb-icon fab icon="twitter"></mdb-icon>
                    </a>
                  </li>
                  <li class="nav-item">
                    <a class="nav-link">
                      <mdb-icon fab icon="google-plus"></mdb-icon>
                    </a>
                  </li>
                  <li class="nav-item">
                    <a class="nav-link">
                      <div class="btn-group" mdbDropdown>
                        <mdb-icon fas icon="user" mdbDropdownToggle></mdb-icon>
                        <div class="dropdown-menu dropdown-menu-right dropdown-primary">
                          <a class="dropdown-item" href="#">Action</a>
                          <a class="dropdown-item" href="#">Another action</a>
                          <a class="dropdown-item" href="#">Something else here</a>
                          <div class="divider dropdown-divider"></div>
                          <a class="dropdown-item" href="#">Separated link</a>
                        </div>
                      </div>
                    </a>
                  </li>
                </ul>
              </links>
              <!-- Collapsible content -->

            </mdb-navbar>
            <!--/.Navbar-->
          
        
    

Navbar with icons on right

        
            
            <!--Navbar-->
            <mdb-navbar SideClass="navbar navbar-expand-lg navbar-dark cyan" [containerInside]="false">

              <!-- Navbar brand -->
              <mdb-navbar-brand><a class="navbar-brand" href="#">Navbar</a></mdb-navbar-brand>

              <!-- Collapsible content -->
              <links>

                <!-- Links -->
                <ul class="navbar-nav ml-auto">
                  <li class="nav-item active">
                    <a class="nav-link waves-light" mdbWavesEffect>
                      <mdb-icon fas icon="envelope"></mdb-icon> Contact<span class="sr-only">(current)</span>
                    </a>
                  </li>
                  <li class="nav-item">
                    <a class="nav-link waves-light" mdbWavesEffect><mdb-icon fas icon="cog"></mdb-icon> Settings</a>
                  </li>

                  <!-- Dropdown -->
                  <li class="nav-item dropdown" dropdown>
                    <a dropdownToggle mdbWavesEffect type="button" class="nav-link dropdown-toggle waves-light" mdbWavesEffect>
                      <mdb-icon fas icon="user"></mdb-icon> Profile<span class="caret"></span></a>
                    <div *dropdownMenu class="dropdown-menu dropdown-menu-right dropdown dropdown-primary" role="menu">
                      <a class="dropdown-item waves-light" mdbWavesEffect href="#">My account</a>
                      <a class="dropdown-item waves-light" mdbWavesEffect href="#">Log out</a>
                    </div>
                  </li>

                </ul>
                <!-- Links -->
              </links>
              <!-- Collapsible content -->

            </mdb-navbar>
            <!--/.Navbar-->
          
        
    

Navbar with image dropdown

        
            
            <!--Navbar-->
            <mdb-navbar SideClass="navbar navbar-expand-lg navbar-dark purple lighten-1" [containerInside]="false">

              <!-- Navbar brand -->
              <mdb-navbar-brand><a class="navbar-brand" href="#">Navbar</a></mdb-navbar-brand>

              <!-- Collapsible content -->
              <links>

                <!-- Links -->
                <ul class="navbar-nav mr-auto">
                  <li class="nav-item active">
                    <a class="nav-link waves-light" mdbWavesEffect>Home<span class="sr-only">(current)</span></a>
                  </li>
                  <li class="nav-item">
                    <a class="nav-link waves-light" mdbWavesEffect>Features</a>
                  </li>
                  <li class="nav-item">
                    <a class="nav-link waves-light" mdbWavesEffect>Pricing</a>
                  </li>

                  <!-- Dropdown -->
                  <li class="nav-item dropdown" dropdown>
                    <a dropdownToggle mdbWavesEffect type="button" class="nav-link dropdown-toggle waves-light" mdbWavesEffect>
                      Basic dropdown<span class="caret"></span></a>
                    <div *dropdownMenu class="dropdown-menu dropdown dropdown-primary" role="menu">
                      <a class="dropdown-item waves-light" mdbWavesEffect href="#">Action</a>
                      <a class="dropdown-item waves-light" mdbWavesEffect href="#">Another action</a>
                      <a class="dropdown-item waves-light" mdbWavesEffect href="#">Something else here</a>
                      <div class="divider dropdown-divider"></div>
                      <a class="dropdown-item waves-light" mdbWavesEffect href="#">Separated link</a>
                    </div>
                  </li>

                </ul>
                <!-- Links -->

                <ul class="navbar-nav ml-auto nav-flex-icons">
                  <li class="nav-item">
                    <a class="nav-link">1 <mdb-icon fas icon="envelope"></mdb-icon></a>
                  </li>
                  <li class="nav-item avatar dropdown" dropdown>
                    <a dropdownToggle mdbWavesEffect type="button" class="nav-link dropdown-toggle waves-light" mdbWavesEffect>
                      <img src="https://mdbootstrap.com/img/Photos/Avatars/avatar-2.webp" alt="" class="img-fluid rounded-circle z-depth-0"></a>
                    <div *dropdownMenu class="dropdown-menu dropdown-menu-right dropdown dropdown-primary" role="menu">
                      <a class="dropdown-item waves-light" mdbWavesEffect href="#">My account</a>
                      <a class="dropdown-item waves-light" mdbWavesEffect href="#">Log out</a>
                    </div>
                  </li>
                </ul>
              </links>
              <!-- Collapsible content -->

            </mdb-navbar>
            <!--/.Navbar-->
          
        
    

Autocollapse navbar on link click (mobile devices):


In order to automatically collapse navbar after click on the link in menu working on mobile devices make sure to add a code routerLink="/your-link-direction" to every element in navbar.

Example:
<a class="dropdown-item waves-light" mdbWavesEffect href="#">Home</a>
should look as follow:
<a routerLink="/home-component" class="dropdown-item waves-light" mdbWavesEffect href="#">Home</a>

NOTE: Rembember to import RouterModule, Routes from @angular/router into your app.module.ts.


Custom content in navbar

In some cases it is required to add an additional element to the navbar - for example, the back button (iOS). The following example shows you how to do this.

Remember that your custom item will always be inserted between the logo and the links.

        
            
            <!--Navbar-->
            <mdb-navbar SideClass="navbar navbar-expand-lg navbar-dark indigo">

              <mdb-navbar-brand>
                <a class="navbar-brand" href="#">
                  <img src="https://mdbootstrap.com/img/logo/mdb-transparent.webp" height="30" class="d-inline-block align-top" alt="">
                </a>
              </mdb-navbar-brand>

              <mdb-icon fas icon="angle-left" size="lg" class="text-white mr-auto d-flex d-md-none align-self-center"></mdb-icon>

              <!-- Collapsible content -->
              <links>

                <!-- Links -->
                <ul class="navbar-nav mr-auto">
                  <li class="nav-item active">
                    <a class="nav-link waves-light" mdbWavesEffect>Home<span class="sr-only">(current)</span></a>
                  </li>
                  <li class="nav-item">
                    <a class="nav-link waves-light" mdbWavesEffect>Features</a>
                  </li>
                  <li class="nav-item">
                    <a class="nav-link waves-light" mdbWavesEffect>Pricing</a>
                  </li>

                  <!-- Dropdown -->
                  <li class="nav-item dropdown" dropdown>
                    <a dropdownToggle mdbWavesEffect type="button" class="nav-link dropdown-toggle waves-light" mdbWavesEffect>
                      Basic dropdown<span class="caret"></span></a>
                    <div *dropdownMenu class="dropdown-menu dropdown dropdown-primary" role="menu">
                      <a class="dropdown-item waves-light" mdbWavesEffect href="#">Action</a>
                      <a class="dropdown-item waves-light" mdbWavesEffect href="#">Another action</a>
                      <a class="dropdown-item waves-light" mdbWavesEffect href="#">Something else here</a>
                      <div class="divider dropdown-divider"></div>
                      <a class="dropdown-item waves-light" mdbWavesEffect href="#">Separated link</a>
                    </div>
                  </li>

                </ul>
                <!-- Links -->

                <!-- Search form -->
                <form class="form-inline waves-light" mdbWavesEffect>
                  <div class="md-form my-0">
                    <input class="form-control mr-sm-2" type="text" placeholder="Search">
                  </div>
                </form>
              </links>
              <!-- Collapsible content -->


            </mdb-navbar>
            <!--/.Navbar-->
          
        
    

Color schemes

Theming the navbar has never been easier thanks to the combination of a simple link color modifier class and background-color utilities. Put another way, you specify light or dark and apply a background color.

You can choose one of over 300 colors from our material palette .



        
            
            <!--/.Navbar red color-->
            <mdb-navbar SideClass="navbar navbar-dark red">
              ...
            </mdb-navbar>
            <!--/.Navbar red color-->
            
            <!--/.Navbar purple color-->
            <mdb-navbar SideClass="navbar navbar-dark purple">
              ...
            </mdb-navbar>
            <!--/.Navbar purple color-->
            
            <!--/.Navbar green color-->
            <mdb-navbar SideClass="navbar navbar-dark green">
              ...
            </mdb-navbar>
            <!--/.Navbar green color-->
          
        
    

If you want to use light background you should apply .navbar-light class to the Navbar, to provide a proper contrast for links.

        
            
            <!--Navbar-->
            <mdb-navbar SideClass="navbar navbar-light blue-grey lighten-5">
              ...
            </mdb-navbar>
            <!--/.Navbar-->
          
        
    

Supported content

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

  • .navbar-brand for your company, 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.

  • .form-inline 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.

Brand

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


        
            
          <!-- As a link -->
          <mdb-navbar SideClass="navbar navbar-dark indigo">
            <mdb-navbar-brand><a class="navbar-brand" href="#">Link</a></mdb-navbar-brand>
          </mdb-navbar>

          <!-- As a heading -->
          <mdb-navbar SideClass="navbar navbar-light blue-grey lighten-4">
            <mdb-navbar-brand><span class="navbar-brand">Heading</span></mdb-navbar-brand>
          </mdb-navbar>
        
        
    

Images

Adding images to the .navbar-brand will likely always require custom styles or utilities to properly size. Here are some examples to demonstrate.

        
            
          <!-- Just an image -->
          <mdb-navbar SideClass="navbar navbar-dark indigo">
            <mdb-navbar-brand>
              <a class="navbar-brand" href="#">
                <img src="https://mdbootstrap.com/img/logo/mdb-transparent.webp" height="30" alt="">
              </a>
            </mdb-navbar-brand>
          </mdb-navbar>
        
        
    

        
            
          <!-- Image and text -->
          <mdb-navbar SideClass="navbar navbar-dark indigo">
            <mdb-navbar-brand>
              <a class="navbar-brand" href="#">
                <img 
                  src="https://mdbootstrap.com/img/logo/mdb-transparent.webp"
                  height="30"
                  class="d-inline-block align-top"
                  alt=""
                >
                Bootstrap
              </a>
            </mdb-navbar-brand>
          </mdb-navbar>
        
        
    

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.

Active states—with .active—to indicate the current page can be applied directly to .nav-links or their immediate parent .nav-items.

        
            
          <mdb-navbar SideClass="navbar navbar-expand-lg navbar-dark indigo">
            <mdb-navbar-brand>
              <a href="#" class="navbar-brand">Navbar</a>
            </mdb-navbar-brand>
            <links>
              <ul class="navbar-nav">
                <li class="nav-item active">
                  <a class="nav-link waves-light" mdbWavesEffect>
                    Home <span class="sr-only">(current)</span>
                  </a>
                </li>
                <li class="nav-item">
                  <a class="nav-link waves-light" mdbWavesEffect>Features</a>
                </li>
                <li class="nav-item">
                  <a class="nav-link waves-light" mdbWavesEffect>Pricing</a>
                </li>
                <li class="nav-item">
                  <a class="nav-link disabled" >Disabled</a>
                </li>
              </ul>
            </links>
          </mdb-navbar>
        
        
    

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

        
            
          <mdb-navbar SideClass="navbar navbar-expand-lg navbar-dark indigo">
            <mdb-navbar-brand>
              <a class="navbar-brand" href="#">Navbar</a>
            </mdb-navbar-brand>
            <links>
              <div class="navbar-nav">
                <a class="nav-item nav-link active waves-light" href="#" mdbWavesEffect>
                  Home <span class="sr-only">(current)</span>
                </a>
                <a class="nav-item nav-link waves-light" href="#" mdbWavesEffect>Features</a>
                <a class="nav-item nav-link waves-light" href="#" mdbWavesEffect>Pricing</a>
                <a class="nav-item nav-link disabled" href="#">Disabled</a>
              </div>
            </links>
          </mdb-navbar>
        
        
    

You may also utilize dropdowns in your navbar nav. 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.

        
            
          <mdb-navbar SideClass="navbar navbar-expand-lg navbar-dark indigo">
            <mdb-navbar-brand>
              <a class="navbar-brand" href="">Navbar</a>
            </mdb-navbar-brand>
            <links>
              <ul class="navbar-nav">
                <li class="nav-item active">
                  <a class="nav-link waves-light" mdbWavesEffect>Home <span class="sr-only">(current)</span></a>
                </li>
                <li class="nav-item">
                  <a class="nav-link waves-light" mdbWavesEffect>Features</a>
                </li>
                <li class="nav-item">
                  <a class="nav-link waves-light" mdbWavesEffect>Pricing</a>
                </li>
                <li class="nav-item dropdown btn-group" dropdown>
                  <a dropdownToggle type="button" class="nav-link dropdown-toggle waves-light" mdbWavesEffect>
                  Basic dropdown<span class="caret"></span></a>
                  <div *dropdownMenu class="dropdown-menu dropdown dropdown-primary" role="menu">
                    <a class="dropdown-item waves-light" href="#" mdbWavesEffect>Action</a>
                    <a class="dropdown-item waves-light" href="#" mdbWavesEffect>Another action</a>
                    <a class="dropdown-item waves-light" href="#" mdbWavesEffect>Something else here</a>
                    <div class="divider dropdown-divider"></div>
                    <a class="dropdown-item waves-light" href="#" mdbWavesEffect>Separated link</a>
                  </div>
                </li>
              </ul>
            </links>
          </mdb-navbar>
        
        
    

Forms

Place various form controls and components within a navbar with .form-inline.

        
            
          <mdb-navbar SideClass="navbar navbar-dark indigo">
            <mdb-navbar-brand>
              <form class="form-inline waves-light" mdbWavesEffect>
                <div class="md-form my-0">
                  <input class="form-control mr-sm-2" type="text" placeholder="Search" aria-label="Search">
                  <button mdbBtn color="success" outline="true" size="sm" class="my-0 waves-light" type="submit" mdbWavesEffect>Search</button>
                </div>
              </form>
            </mdb-navbar-brand>
          </mdb-navbar>
        
        
    

Heading

Align the contents of your inline forms with utilities as needed.

        
            
          <mdb-navbar SideClass="navbar navbar-expand-lg navbar-dark indigo justify-content-between">
            <mdb-navbar-brand>
              <a class="navbar-brand" href="">Navbar</a>
            </mdb-navbar-brand>
            <links>
              <form class="form-inline waves-light waves-light ml-auto" mdbWavesEffect>
                <div class="md-form my-0">
                  <input class="form-control mr-sm-2" type="text" placeholder="Search" aria-label="Search">
                  <button mdbBtn color="success" outline="true" size="sm" class="my-0 waves-light" type="submit" mdbWavesEffect>Search</button>
                </div>
              </form>
            </links>
          </mdb-navbar>
        
        
    

Input groups work, too:

        
            
          <mdb-navbar SideClass="navbar navbar-expand-lg navbar-dark indigo">
            <links>
              <form class="form-inline waves-light" mdbWavesEffect>
                <div class="input-group">
                  <span class="input-group-addon" id="basic-addon1">@</span>
                  <input type="text" class="form-control" placeholder="Username" aria-label="Username" aria-describedby="basic-addon1">
                </div>
              </form>
            </links>
          </mdb-navbar>
        
        
    

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.

        
            
          <mdb-navbar SideClass="navbar navbar-expand-lg navbar-dark indigo">
            <links>
              <form class="form-inline">
                <form class="form-inline">
                  <button mdbBtn color="success" outline="true" class="waves-light" mdbWavesEffect type="button">Main button</button>
                  <button mdbBtn color="secondary" outline="true" size="sm" class="align-middle waves-light" mdbWavesEffect type="button">
                    Smaller button
                  </button>
                </form>
              </form>
            </links>
          </mdb-navbar>
        
        
    

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.

        
            
          <mdb-navbar SideClass="navbar navbar-expand-lg navbar-dark indigo">
            <links>
              <span class="navbar-text white-text">
                Navbar text with an inline element
              </span>
            </links>
          </mdb-navbar>
        
        
    

Mix and match with other components and utilities as needed.

        
            
          <mdb-navbar SideClass="navbar navbar-expand-lg navbar-dark indigo">
            <mdb-navbar-brand>
              <a class="navbar-brand" href="#">Navbar / text</a>
            </mdb-navbar-brand>
            <links>
              <ul class="navbar-nav mr-auto">
                <li class="nav-item active">
                  <a class="nav-link waves-light" href="#" mdbWavesEffect>Home <span class="sr-only">(current)</span></a>
                </li>
                <li class="nav-item">
                  <a class="nav-link waves-light" href="#" mdbWavesEffect>Features</a>
                </li>
                <li class="nav-item">
                  <a class="nav-link waves-light" href="#" mdbWavesEffect>Pricing</a>
                </li>
              </ul>
              <span class="navbar-text white-text">
                Navbar text with an inline element
              </span>
            </links>
          </mdb-navbar>
        
        
    

Containers

Although it’s not required, you can wrap a navbar in a .container to center it on a page or add one within to only center the contents of a fixed or static top navbar

Live demo
        
            
        <div class="container">
          <mdb-navbar SideClass="navbar navbar-expand-lg navbar-dark indigo" [containerInside]="false">
            <mdb-navbar-brand>
              <a class="navbar-brand" href="#">Navbar</a>
            </mdb-navbar-brand>
          </mdb-navbar>
        </div>
        
        
    

When the container is within your navbar, its horizontal padding is removed at breakpoints lower than your specified .navbar-expand{-sm|-md|-lg|-xl} class. This ensures we’re not doubling up on padding unnecessarily on lower viewports when your navbar is collapsed.

Live demo
        
            
        <mdb-navbar SideClass="navbar navbar-expand-lg navbar-dark indigo" [containerInside]="true">
          <mdb-navbar-brand>
            <a class="navbar-brand" href="#">Navbar</a>
          </mdb-navbar-brand>
        </mdb-navbar>
        
        
    

Placement

Use our position utilities to place navbars in non-static positions. Choose from fixed to the top, fixed to the bottom, or stickied to the top. Note that position: sticky, used for .sticky-top, isn’t fully supported in every browser.

Fixed top

Live demo
        
            
          <mdb-navbar SideClass="navbar navbar-dark indigo fixed-top">
            <mdb-navbar-brand>
              <a class="navbar-brand" href="#">Navbar</a>
            </mdb-navbar-brand>
          </mdb-navbar>
        
        
    

Fixed bottom

Live demo
        
            
          <mdb-navbar SideClass="navbar navbar-dark indigo fixed-bottom">
            <mdb-navbar-brand>
              <a class="navbar-brand" href="#">Navbar</a>
            </mdb-navbar-brand>
          </mdb-navbar>
        
        
    

Sticky top

Live demo
        
            
          <mdb-navbar SideClass="navbar navbar-dark indigo sticky-top">
            <mdb-navbar-brand>
              <a class="navbar-brand" href="#">Navbar</a>
            </mdb-navbar-brand>
          </mdb-navbar>
        
        
    

Responsive behaviors

Navbars can utilize .navbar-toggler, .navbar-collapse, and .navbar-expand{-sm|-md|-lg|-xl} classes to change 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.

Toggler

Navbar togglers are left-aligned by default, but should they follow a sibling element like a .navbar-brand, they’ll automatically be aligned to the far right. Reversing your markup will reverse the placement of the toggler. Below are examples of different toggle styles.

With no .navbar-brand shown in lowest breakpoint:

        
            
          <mdb-navbar SideClass="navbar navbar-expand-lg navbar-dark indigo">
            <links>
              <a class="navbar-brand" href="#">Hidden brand</a>
              <ul class="navbar-nav mr-auto mt-lg-0">
                <li class="nav-item active">
                  <a class="nav-link" href="#">Home <span class="sr-only">(current)</span></a>
                </li>
                <li class="nav-item">
                  <a class="nav-link" href="#">Link</a>
                </li>
                <li class="nav-item">
                  <a class="nav-link disabled" href="#">Disabled</a>
                </li>
              </ul>
            </links>
          </mdb-navbar>
        
        
    

With a brand name shown on the left and toggler on the right:

        
            
          <mdb-navbar SideClass="navbar navbar-expand-lg navbar-dark indigo">
            <mdb-navbar-brand>
              <a class="navbar-brand" href="#">Navbar</a>
            </mdb-navbar-brand>
            <links>
              <div class="collapse navbar-collapse">
                <ul class="navbar-nav mr-auto mt-lg-0">
                  <li class="nav-item active">
                    <a class="nav-link" href="#">Home <span class="sr-only">(current)</span></a>
                  </li>
                  <li class="nav-item">
                    <a class="nav-link" href="#">Link</a>
                  </li>
                  <li class="nav-item">
                    <a class="nav-link disabled" href="#">Disabled</a>
                  </li>
                </ul>
              </div>
            </links>
          </mdb-navbar>
        
        
    

Scrolling navbar

By adding .scrolling-navbar class to your fixed-top navbar, you can give it an smooth animation on a scroll.

Live demo
        
            
          <mdb-navbar SideClass="navbar navbar-expand-lg navbar-dark indigo fixed-top scrolling-navbar">
            [..]
          </mdb-navbar>
        
        
    

Double navigation MDB Pro component

MDB provides you multiple useful, ready-to-use page layouts with various predefined navigation types.

Click buttons below to learn more:

Predefined layouts Predefined skins

Angular Navbar - API

In this section you will find informations about required modules and available inputs, outputs, methods and events of navbar component.


Modules used

In order to speed up your application, you can choose to import only the modules you actually need, instead of importing the entire MDB Angular library. Remember that importing the entire library, and immediately afterwards a specific module, is bad practice, and can cause application errors.

API Reference for MDB Angular Navbars:
        
            
          import { NavbarModule, WavesModule, ButtonsModule } from 'ng-uikit-pro-standard'
        
        
    
        
            
          import { NavbarModule, WavesModule, ButtonsModule } from 'angular-bootstrap-md'
        
        
    

Components

MdbNavbar

Selector: mdb-navbar

Type: NavbarComponent

MdbNavbarBrand

Selector: mdb-navbar-brand

Type: LogoComponent

Links

Selector: links

Type: LinksComponent


Inputs

MdbNavbar
Name Type Default Description Example
containerInside boolean true Allow to add container for navbar content [containerInside]="false"
iconBackground string | string[]; - Allow to change background color of hamburger icon [iconBackground]="'purple'"
scrollSensitivity number 120 Allow to specifiy scroll amount needed for the top-nav-collapse class to be added [scrollSensitivity]="60"
SideClass string - Allow to add custom classes to navbar [SideClass]="'navbar navbar-expands indigo'"
scrollableNavbar boolean false Allow to scroll navbar content without scrolling page [scrollableNavbar]="true"

Methods

You can get access to the navbar methods from another component. Add template reference variable to your mdb-navbar component in HTML file:

<mdb-navbar #navbar></mdb-navbar>

Then in your typescript file use @ViewChild decorator to get access to MdbNavbar methods:

@ViewChild('navbar', { static: true }) navbar: NavbarComponent

Name Description Example
show Open navbar (to use on the expandable navbar) this.navbar.show()
hide Close navbar (to use on the expandable navbar) this.navbar.hide()
toggle Open or close navbar (to use on the expandable navbar) this.navbar.toggle()