Sign in


Sign up


Angular Bootstrap navbar

The 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 -->
    <logo><a class="navbar-brand" href="#">Navbar</a></logo>

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

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

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

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

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

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

Data structure:


import { Component } from '@angular/core'; 

@Component({ 
    selector: 'navbar-component-example', 
    templateUrl: 'navbar.component.html'
}) 

export class NavbarComponentExample { 

}
            

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 form 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-->
                

Data structure:


import { Component } from '@angular/core'; 

@Component({ 
    selector: 'navbar-component-example', 
    templateUrl: 'navbar.component.html'
}) 

export class NavbarComponentExample { 

}
                

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

Data structure:


import { Component } from '@angular/core'; 

@Component({ 
    selector: 'navbar-component-example', 
    templateUrl: 'navbar.component.html'
}) 

export class NavbarComponentExample { 

}
                

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">
    <logo><a class="navbar-brand" href="#">Link</a></logo>
</mdb-navbar>

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

Data structure:


import { Component } from '@angular/core'; 

@Component({ 
    selector: 'navbar-component-example', 
    templateUrl: 'navbar.component.html'
}) 

export class NavbarComponentExample { 

}
            

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">
    <logo>
        <a class="navbar-brand" href="#">
            <img src="https://mdbootstrap.com/img/logo/mdb-transparent.png" height="30" alt="">
        </a>
    </logo>
</mdb-navbar>
            

Data structure:


import { Component } from '@angular/core'; 

@Component({ 
    selector: 'navbar-component-example', 
    templateUrl: 'navbar.component.html'
}) 

export class NavbarComponentExample { 

}
            


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

Data structure:


import { Component } from '@angular/core'; 

@Component({ 
    selector: 'navbar-component-example', 
    templateUrl: 'navbar.component.html'
}) 

export class NavbarComponentExample { 

}
            

Nav

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">
    <logo>
        <a href="#" class="navbar-brand">Navbar</a>
    </logo>
    <links>
        <ul class="navbar-nav">
            <li class="nav-item active">
                <a class="nav-link waves-light" mdbRippleRadius>Home <span class="sr-only">(current)</span></a>
            </li>
            <li class="nav-item">
                <a class="nav-link waves-light" mdbRippleRadius>Features</a>
            </li>
            <li class="nav-item">
                <a class="nav-link waves-light" mdbRippleRadius>Pricing</a>
            </li>
            <li class="nav-item">
                <a class="nav-link disabled" >Disabled</a>
            </li>
        </ul>
    </links>
</mdb-navbar>
            

Data structure:


import { Component } from '@angular/core'; 

@Component({ 
    selector: 'navbar-component-example', 
    templateUrl: 'navbar.component.html'
}) 

export class NavbarComponentExample { 

}
            

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">
    <logo>
        <a class="navbar-brand" href="#">Navbar</a>
    </logo>
    <links>
        <div class="navbar-nav">
            <a class="nav-item nav-link active waves-light" href="#" mdbRippleRadius>Home <span class="sr-only">(current)</span></a>
            <a class="nav-item nav-link waves-light" href="#" mdbRippleRadius>Features</a>
            <a class="nav-item nav-link waves-light" href="#" mdbRippleRadius>Pricing</a>
            <a class="nav-item nav-link disabled" href="#">Disabled</a>
        </div>
    </links>
</mdb-navbar>
            

Data structure:


import { Component } from '@angular/core'; 

@Component({ 
    selector: 'navbar-component-example', 
    templateUrl: 'navbar.component.html'
}) 

export class NavbarComponentExample { 

}
            

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

Data structure:


import { Component } from '@angular/core'; 

@Component({ 
    selector: 'navbar-component-example', 
    templateUrl: 'navbar.component.html'
}) 

export class NavbarComponentExample { 

}
            

Forms

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


<mdb-navbar SideClass="navbar navbar-dark indigo">
    <form class="form-inline waves-light" mdbRippleRadius>
        <input class="form-control mr-sm-2" type="text" placeholder="Search" aria-label="Search">
        <button class="btn btn-outline-success btn-sm my-0 waves-light" type="submit" mdbRippleRadius>Search</button>
    </form>
</mdb-navbar>
            

Data structure:


import { Component } from '@angular/core'; 

@Component({ 
    selector: 'navbar-component-example', 
    templateUrl: 'navbar.component.html'
}) 

export class NavbarComponentExample { 

}
            

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">
    <logo>
        <a class="navbar-brand" href="">Navbar</a>
    </logo>
    <links>
        <form class="form-inline waves-light waves-light ml-auto" mdbRippleRadius>
            <input class="form-control mr-sm-2" type="text" placeholder="Search" aria-label="Search">
            <button class="btn btn-outline-success btn-sm my-0 waves-light" type="submit" mdbRippleRadius>Search</button>
        </form>
    </links>
</mdb-navbar>
            

Data structure:


import { Component } from '@angular/core'; 

@Component({ 
    selector: 'navbar-component-example', 
    templateUrl: 'navbar.component.html'
}) 

export class NavbarComponentExample { 

}
            

Input groups work, too:


<mdb-navbar SideClass="navbar navbar-expand-lg navbar-dark indigo">
    <links>
        <form class="form-inline waves-light" mdbRippleRadius>
            <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>
            

Data structure:


import { Component } from '@angular/core'; 

@Component({ 
    selector: 'navbar-component-example', 
    templateUrl: 'navbar.component.html'
}) 

export class NavbarComponentExample { 

}
            

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 class="btn btn-outline-success waves-light" mdbRippleRadius type="button">Main button</button>
                <button class="btn btn-sm align-middle btn-outline-secondary waves-light" mdbRippleRadius type="button">Smaller button</button>
            </form>
        </form>
    </links>
</mdb-navbar>
            

Data structure:


import { Component } from '@angular/core'; 

@Component({ 
    selector: 'navbar-component-example', 
    templateUrl: 'navbar.component.html'
}) 

export class NavbarComponentExample { 

}
            

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>
            

Data structure:


import { Component } from '@angular/core'; 

@Component({ 
    selector: 'navbar-component-example', 
    templateUrl: 'navbar.component.html'
}) 

export class NavbarComponentExample { 

}
            

Mix and match with other components and utilities as needed.


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

Data structure:


import { Component } from '@angular/core'; 

@Component({ 
    selector: 'navbar-component-example', 
    templateUrl: 'navbar.component.html'
}) 

export class NavbarComponentExample { 

}
            

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">
        <logo>
            <a class="navbar-brand" href="#">Navbar</a>
        </logo>
    </mdb-navbar>
</div>
            

Data structure:


import { Component } from '@angular/core'; 

@Component({ 
    selector: 'navbar-component-example', 
    templateUrl: 'navbar.component.html'
}) 

export class NavbarComponentExample { 

}
            

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">
    <logo>
        <a class="navbar-brand" href="#">Navbar</a>
    </logo>
</mdb-navbar>
            

Data structure:


import { Component } from '@angular/core'; 

@Component({ 
    selector: 'navbar-component-example', 
    templateUrl: 'navbar.component.html'
}) 

export class NavbarComponentExample { 

}
            

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">
    <logo>
        <a class="navbar-brand" href="#">Navbar</a>
    </logo>
</mdb-navbar>
            

Data structure:


import { Component } from '@angular/core'; 

@Component({ 
    selector: 'navbar-component-example', 
    templateUrl: 'navbar.component.html'
}) 

export class NavbarComponentExample { 

}
            

Fixed bottom

Live demo

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

Data structure:


import { Component } from '@angular/core'; 

@Component({ 
    selector: 'navbar-component-example', 
    templateUrl: 'navbar.component.html'
}) 

export class NavbarComponentExample { 

}
            

Sticky top

Live demo

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

Data structure:


import { Component } from '@angular/core'; 

@Component({ 
    selector: 'navbar-component-example', 
    templateUrl: 'navbar.component.html'
}) 

export class NavbarComponentExample { 

}
            

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>
            

Data structure:


import { Component } from '@angular/core'; 

@Component({ 
    selector: 'navbar-component-example', 
    templateUrl: 'navbar.component.html'
}) 

export class NavbarComponentExample { 

}
            

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


<mdb-navbar SideClass="navbar navbar-expand-lg navbar-dark indigo">
    <logo>
        <a class="navbar-brand" href="#">Navbar</a>
    </logo>
    <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>
            

Data structure:


import { Component } from '@angular/core'; 

@Component({ 
    selector: 'navbar-component-example', 
    templateUrl: 'navbar.component.html'
}) 

export class NavbarComponentExample { 

}
            

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>
            

Data structure:


import { Component } from '@angular/core'; 

@Component({ 
    selector: 'navbar-component-example', 
    templateUrl: 'navbar.component.html'
}) 

export class NavbarComponentExample { 

}
            

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