Vue Bootstrap Navbar

Bootstrap navbar is a horizontal navigation component which apart from traditional, text links, might embed icons, dropdowns, avatars or search forms.

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 don't require adding .navbar-expand{-sm|-md|-lg|-xl} classes for responsive collapsing. The .navbar-expand-lg class is added by defoult but you can easily change it by using expand prop. You can also use color scheme prop or classes.

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

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

  • Navbars are responsive by default and you can easily modify them to change that.

  • <navbar> component by default is using nav element, but you can easily change it to more generic element such as a <div>, just add a tag="div" prop to every navbar

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 dark-themed navbar that automatically collapses at the lg (large) breakpoint.


<!--Navbar-->
<navbar class="indigo" dark>
  <!-- Navbar brand -->
  <mdb-navbar-brand href="https://mdbootstrap.com/">
    Navbar
  </mdb-navbar-brand>
  <navbar-collapse>
    <navbar-nav>
      <navbar-item href="#" active>Home</navbar-item>
      <navbar-item href="#">Features</navbar-item>
      <navbar-item href="#">Pricing</navbar-item>
      <!-- Dropdown -->
      <dropdown tag="li" class="nav-item">
        <dropdown-toggle tag="a" navLink color="indigo" slot="toggle" waves-fixed>Dropdown</dropdown-toggle>
        <dropdown-menu>
          <dropdown-item>Action</dropdown-item>
          <dropdown-item>Another action</dropdown-item>
          <dropdown-item>Something else here</dropdown-item>
        </dropdown-menu>
      </dropdown>
    </navbar-nav>
    <!-- Search form -->
    <form class="form-inline">
      <input class="form-control mr-auto p-2" type="text" placeholder="Search" aria-label="Search">
    </form>
  </navbar-collapse>
</navbar>
            

Color schemes

Theming the navbar has never been easier thanks to the combination of a color prop for Bootstrap utility classes and simple color classes. 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-->
<navbar class="red">
. . .
</navbar>
<!--/.Navbar red color-->

<!--/.Navbar purple color-->
<navbar color="primary">
. . .
</navbar>
<!--/.Navbar purple color-->

<!--/.Navbar green color-->
<navbar class="green">
. . .
</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. For dark background use dark prop.

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

Supported content

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

  • <mdb-navbar-brand> for your company, product, or project name.

  • <mdb-navbar-nav> for a full-height and lightweight navigation (including support for dropdowns).

  • for any form controls and actions.

  • <mdb-navbar-collapse> for grouping and hiding navbar contents by a parent breakpoint.

  • .navbar-text for adding vertically centered strings of text.

Brand

The <mdb-navbar-brand> component let you present your company, product, or project name. It can be used with href and tag props.


<!--Navbar-->
<navbar class="indigo" dark>
  <!-- Navbar brand -->
  <mdb-navbar-brand href="https://mdbootstrap.com/">
    Link
  </mdb-navbar-brand>
</navbar>
            

Images

Adding images to the <mdb-navbar-brand> will likely always require custom styles or utilities to properly size. Here is example to demonstrate.


<!--Navbar-->
<navbar>
  <!-- Navbar brand -->
  <mdb-navbar-brand href="https://mdbootstrap.com/">
    <img src="https://mdbootstrap.com/img/logo/mdb-transparent.png" height="30" alt="">
  </mdb-navbar-brand>
</navbar>
            
                

Nav

Navbar navigation links build on our <navbar> component require the use of <navbar-collapse> component 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 the active boolean prop indicate the current page can be applied directly to <navbar-item> components.


<!--Navbar-->
<navbar class="indigo" dark>
  <!-- Navbar brand -->
  <mdb-navbar-brand href="#">
    Navbar
  </mdb-navbar-brand>
  <navbar-collapse>
    <navbar-nav>
      <navbar-item href="#" class="active">Home</navbar-item>
      <navbar-item href="#">Features</navbar-item>
      <navbar-item href="#">Pricing</navbar-item>
      <navbar-item class="disabled" href="#">Disabled</navbar-item>
    </navbar-nav>
  </navbar-collapse>
</navbar>
            

You may also utilize dropdowns in your navbar. To do so, simply include the <dropdown> component, as shown below.

              
<navbar class="indigo" dark>
  <!-- Navbar brand -->
  <mdb-navbar-brand href="#">
    Navbar
  </mdb-navbar-brand>
  <navbar-collapse>
    <navbar-nav>
      <navbar-item href="#" active> Home</navbar-item>
      <navbar-item href="#">Features</navbar-item>
      <navbar-item href="#">Pricing</navbar-item>
      <dropdown tag="li" class="nav-item">
        <dropdown-toggle tag="a" navLink color="indigo" slot="toggle"  waves-fixed>Dropdown link</dropdown-toggle>
        <dropdown-menu>
            <dropdown-item>Action</dropdown-item>
            <dropdown-item>Another action</dropdown-item>
            <dropdown-item>Something else here</dropdown-item>
        </dropdown-menu>
        </dropdown>
    </navbar-nav>
  </navbar-collapse>
</navbar>
              
            

Forms

Place various form controls and components within a navbar with .form-inlineclass or <form-inline>component.

<navbar>
    <form class="form-inline">
        <input class="form-control mr-sm-2" type="text" placeholder="Search" aria-label="Search">
        <btn outline="success" size="sm" class="my-0" type="submit">Search</btn>
    </form>
</navbar>

Heading

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

              
<navbar class="justify-content-between">
  <mdb-navbar-brand href="#">
    Navbar
  </mdb-navbar-brand>
  <form class="form-inline">
    <input class="form-control mr-sm-2" type="text" placeholder="Search" aria-label="Search">
    <btn outline="success" size="sm" class="my-0" type="submit">Search</btn>
  </form>
</navbar>
              
          

Input groups work, too:


<navbar>
  <form class="form-inline">
    <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>
</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.

<navbar>
    <form class="form-inline">
        <btn outline="success" size="lg" type="button">Search</btn>
        <btn outline="secondary" size="sm" type="button">Search</btn>
    </form>
</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.

<navbar>
    <span class="navbar-text white-text">
        Navbar text with an inline element
    </span>
</navbar>

Mix and match with other components and utilities as needed.


<navbar>
  <!-- Navbar brand -->
  <mdb-navbar-brand href="#">
    Navbar / text
  </mdb-navbar-brand>
  <navbar-collapse>
    <navbar-nav>
        <navbar-item href="#" active>Home</navbar-item>
        <navbar-item href="#">Features</navbar-item>
        <navbar-item href="#">Pricing</navbar-item>
    </navbar-nav>
    <span class="navbar-text">
        Navbar text with an inline element
    </span>
  </navbar-collapse>
</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
<container>
    <navbar class="indigo">
        . . .
    </navbar>
</container>

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
<navbar class="indigo">
    . . .
</navbar>

Placement

Use our position prop 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
<navbar position="top" class="indigo">
    . . .
</navbar>

Fixed bottom

Live demo
<navbar position="bottom" class="indigo">
    . . .
</navbar>
            

Sticky top

Live demo
<navbar position="sticky-top" class="indigo">
    . . .
</navbar>

Responsive behaviors

Navbars can utilize expand prop to change when their content collapses behind a button. By adding small, medium, large you can easily choose when to show or hide particular elements.

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 a brand name shown on the left and toggler on the right:


<navbar expand="large" dark class="indigo">
  <!-- Navbar brand -->
  <mdb-navbar-brand href="#">
    Navbar
  </mdb-navbar-brand>
  <navbar-collapse>
      <navbar-nav>
          <navbar-item href="#" active>Home</navbar-item>
          <navbar-item href="#">Link</navbar-item>
          <navbar-item class="disabled" href="#">Disabled</navbar-item>
      </navbar-nav>
  </navbar-collapse>
</navbar>