# Navbars

Documentation and examples for Bootstrap's powerful, responsive navigation header, the navbar. Includes support for branding, navigation, and more, including support for our collapse plugin.

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.
  • 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.
  • Navbars are hidden by default when printing. Force them to be printed by adding .d-print to the .navbar.
  • 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.
  • You need a `sidebar-collapse` class on document body in order to make the navbars work properly on mobile

You don't have to worry about most of the points above because we created a custom Navbar component that is simple to use. It's good to know all the details, just in case you want to customize this component.


To use the navbar, first import it:
import {Navbar} from 'src/components'
1

Global usage

Vue.component(Navbar)
1

Local usage

export default {
 components: {
   Navbar
 }
}
1
2
3
4
5

# Primary navbar

:::tip showMenu property applies only on small viewport (mobile). Shrink the browser to see that in action :::

<template>
  <navbar type="primary" menu-classes="ml-auto" class="z-index-high">
    <template slot-scope="{toggle, isToggled}">
      <div class="navbar-translate">
        <a href="#">Navbar</a>
      </div>
    </template>
    <template slot="navbar-menu">
      <li class="nav-item">
        <a class="nav-link" href="#pablo"><i class="now-ui-icons ui-1_send"
          aria-hidden="true"></i></a>
      </li>
      <li class="nav-item">
        <a class="nav-link" href="#pablo"><i class="now-ui-icons users_single-02"
          aria-hidden="true"></i></a>
      </li>
    </template>
  </navbar>
</template>

<script>
  export default {}
</script>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23

:::tip You can change navbar color with the type prop. :::

Navbar with links

<template>
  <navbar type="primary" class="z-index-high">
   <a class="navbar-brand" href="#">Navbar</a>
    <template slot="navbar-menu">
      <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="#">Features</a>
      </li>
      <li class="nav-item">
        <a class="nav-link" href="#">Pricing</a>
      </li>
      <li class="nav-item">
        <a class="nav-link disabled" href="#">Disabled</a>
      </li>
    </template>
  </navbar>
</template>

<script>
  export default {}
</script>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23

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.

<template>
  <navbar type="primary" class="z-index-high">
   <a class="navbar-brand" href="#">Navbar</a>
    <template slot="navbar-menu">
      <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="#">Features</a>
      </li>
      <li class="nav-item">
        <a class="nav-link" href="#">Pricing</a>
      </li>
      <drop-down tag="li" class="nav-item" title="Dropdown Link">

       <a class="dropdown-item" href="#">Action</a>
       <a class="dropdown-item" href="#">Another action</a>
       <a class="dropdown-item" href="#">Something else here</a>
      </drop-down>
    </template>
  </navbar>
</template>

<script>
  export default {}
</script>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26

# Forms

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

<template>
  <navbar type="primary" class="z-index-high">
   <a class="navbar-brand" href="#">Brand</a>
    <template slot="navbar-menu">
      <li class="nav-item active">
          <a href="#pablo" class="nav-link">link</a>
      </li>
      <li class="nav-item">
          <a href="#pablo" class="nav-link">link</a>
      </li>
    </template>
    <form slot="after-menu" class="form-inline ml-auto" data-background-color>
        <fg-input addon-left-icon="now-ui-icons ui-1_email-85" placeholder="Your Email..."></fg-input>
    </form>
  </navbar>
</template>

<script>
  export default {}
</script>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20

# How to enable Burger Menu

We created for you a class named .burger-menu and once it is applied to the tag body it will transform the navbar like it appears on the responsive mode and when you will open it will come from the right side or left side. To make open from left side please add the class .menu-on-left also on the body tag.

<!doctype html>
<html lang="en">
  <head>
    ...
  </head>
  <body class="burger-menu">
    ...
  </body>
</html>
1
2
3
4
5
6
7
8
9

# Colored navbars

<template>
  <navbar v-for="type in types" :key="type"
          :type="type"
          :transparent="false"
          menu-classes="ml-auto"
          position="relative">
       <a class="navbar-brand" href="#">{{type}}</a>
       <template slot="navbar-menu">
         <li class="nav-item active">
           <a class="nav-link" href="#pablo">
             <i class="now-ui-icons objects_globe"></i>
             <p>Discover</p>
           </a>
         </li>
         <li class="nav-item">
           <a class="nav-link" href="#pablo">
             <i class="now-ui-icons users_circle-08"></i>
             <p>Profile</p>
           </a>
         </li>
         <li class="nav-item">
           <a class="nav-link" href="#pablo">
             <i class="now-ui-icons ui-1_settings-gear-63"></i>
             <p>Settings</p>
           </a>
         </li>
        </template>
   </navbar>
</template>

<script>
  export default {
    data(){
      return {
        types: ['white', 'default', 'primary', 'danger', 'success', 'warning', 'info']
      }
    }
  }
</script>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39

# 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 (scrolls with the page until it reaches the top, 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.

Also note that .sticky-top uses position: sticky, which isn’t fully supported in every browser.

<template>
  <navbar type="primary" class="z-index-high">
   <a class="navbar-brand" href="#">Default</a>
  </navbar>
</template>

<script>
  export default {}
</script>
1
2
3
4
5
6
7
8
9
<template>
    <div class="demo-container bd-example">
     <navbar type="primary" class="fixed-top">
       <a class="navbar-brand" href="#">Fixed Top</a>
      </navbar>
    </div>
</template>

<script>
  export default {}
</script>
1
2
3
4
5
6
7
8
9
10
11
<template>
  <div class="demo-container bd-example">
   <navbar type="primary" class="fixed-bottom">
     <a class="navbar-brand" href="#">Fixed Bottom</a>
    </navbar>
  </div>
</template>

<script>
  export default {}
</script>
1
2
3
4
5
6
7
8
9
10
11
<template>
  <div class="demo-container bd-example">
   <navbar type="primary" class="sticky-top">
     <a class="navbar-brand" href="#">Sticky Top</a>
    </navbar>
  </div>
</template>

<script>
  export default {}
</script>
1
2
3
4
5
6
7
8
9
10
11

# 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. These classes can be also added with the help of expand prop. E.g expand="md"

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. Note that we already integrated a toggler button inside our Navbar component so you don't have to worry about adding it. It will simply appear on small screens.

Name Description
default Navbar left side content (brand and toggle button )
navbar-menu Content of the navbar (right on desktop, dropdown menu on mobile)