The navbar is fully contained by an HTML5 Nav tag. Inside a recommended container div,there are 2 main parts of the navbar. A logo or brand link,and the navigations links. You can align these links to the left or right.

Right Aligned Links

To right align your navbar links,just add a rightclass to your <ul>that contains them.

<nav><div class="nav-wrapper"><a href="#" class="brand-logo">Logo</a><ul id="nav-mobile" class="right hide-on-med-and-down"><li><a href="#">Sass</a></li><li><a href="#">Components</a></li><li><a href="#">JavaScript</a></li></ul></div></nav>

Left Aligned Links

To left align your navbar links,just add a leftclass to your <ul>that contains them.

<nav><div class="nav-wrapper"><a href="#" class="brand-logo right">Logo</a><ul id="nav-mobile" class="left hide-on-med-and-down"><li><a href="#">Sass</a></li><li><a href="#">Components</a></li><li><a href="#">JavaScript</a></li></ul></div></nav>

Centering the logo

Navbar Gradient color with shadow

Apart from the material solid colors you can also use the gradient color feature with Navbar. Just add gradient-45deg-purple-deep-orange gradient-shadowclass to your <nav>tag.

<nav class="gradient-45deg-purple-deep-orange gradient-shadow"><div class="nav-wrapper"><a href="#" class="brand-logo center">Logo</a><ul id="nav-mobile" class="left hide-on-med-and-down"><li><a href="#">Sass</a></li><li><a href="#">Components</a></li><li><a href="#">JavaScript</a></li></ul></div></nav>

Active Items

Add active class to your li tags to denote the current page.

<nav><div class="nav-wrapper"><a href="#!" class="brand-logo center">Logo</a><ul class="left hide-on-med-and-down"><li><a href="#">Sass</a></li><li><a href="#">Components</a></li><li class="active"><a href="#">JavaScript</a></li></ul></div></nav>

Extended Navbar with Tabs

To add extended components to the navbar,add the class nav-extendedto the outer navtag. This will allow your navbar height to be variable. Then you can just include a tabs component inside the nav-wrapper.

Jelly beans chocolate gummies gummies I love. Cupcake cake bear claw tart wafer tootsie roll. Dessert biscuit gummi bears oat cake apple pie jelly halvah cupcake.
Liquorice powder tart danish biscuit I love. Cotton candy biscuit carrot cake bear claw jelly-o tiramisu. Tootsie roll fruitcake brownie cotton candy pudding gummi bears.
Cupcake ipsum dolor sit. Amet cake apple pie cupcake. Sugar plum icing tootsie roll.
Cupcake ipsum dolor sit. Amet jelly-o pie. Cake cake pie lemon drops pie candy canes.
<nav class="nav-extended"><div class="nav-wrapper"><a href="#" class="brand-logo">Logo</a><a href="#" data-target="mobile-demo" class="button-collapse  hide-on-med-and-up"><i class="material-icons">menu</i></a><ul id="nav-mobile" class="right hide-on-med-and-down"><li><a href="#">Sass</a></li><li><a href="#">Components</a></li><li><a href="#">JavaScript</a></li></ul><ul class="sidenav" id="mobile-demo"><li><a href="#">Sass</a></li><li><a href="#">Components</a></li><li><a href="#">JavaScript</a></li></ul></div><div class="nav-content"><ul class="tabs tabs-transparent"><li class="tab"><a href="#test1">Test 1</a></li><li class="tab"><a class="active" href="#test2">Test 2</a></li><li class="tab disabled"><a href="#test3">Disabled Tab</a></li><li class="tab"><a href="#test4">Test 4</a></li></ul></div></nav><div id="test1" class="col s12">Test 1</div><div id="test2" class="col s12">Test 2</div><div id="test3" class="col s12">Test 3</div><div id="test4" class="col s12">Test 4</div>

Icon left or right


For adding an icon to a text link you need to add either a left or right class to the icon depending on where you want the icon to be.


  <nav>
    <div class="nav-wrapper">
      <a href="#!" class="brand-logo">Logo</a>
      <ul class="right hide-on-med-and-down">
        <li><a href="#"><i class="material-icons left">search</i>Link with Left Icon</a></li>
        <li><a href="#"><i class="material-icons right">view_module</i>Link with Right Icon</a></li>
      </ul>
    </div>
  </nav>

Halfway FAB in Extended Navbar

Add a halfway FAB to your extended navbar.

<nav class="nav-extended"><div class="nav-wrapper"><a href="#!" class="brand-logo">Logo</a><ul class="right hide-on-med-and-down"><li><a>A link</a></li><li><a>A second link</a></li><li><a>A third link</a></li></ul></div><div class="nav-content"><span class="nav-title">Title</span><a class="btn-floating btn-large halfway-fab waves-effect waves-light teal"><i class="material-icons">add</i></a></div></nav>

Mobile Collapse Button


When your nav bar is resized,you will see that the links on the right turn into a hamburger icon menu. Take a look at the example below to get this functionality. Add the entire button-collapseline to your nav.

<nav><div class="nav-wrapper"><a href="#!" class="brand-logo">Logo</a><a href="#" data-target="mobile-demo2" class="button-collapse hide-on-med-and-up sidenav-trigger"><i class="material-icons">menu</i></a><ul class="right hide-on-med-and-down"><li><a href="#">Sass</a></li><li><a href="#">Components</a></li><li><a href="#">Javascript</a></li><li><a href="#">Mobile</a></li></ul><ul class="sidenav" id="mobile-demo2"><li><a href="#">Sass</a></li><li><a href="#">Components</a></li><li><a href="#">Javascript</a></li><li><a href="#">Mobile</a></li></ul></div></nav>

Initialization

After including the sidenav-triggerline into your navbar,all you have to do now is place this code in your page's $( document ).ready(function(){}) code. This example below assumes you have not modified the classes in the above example. In the case that you have, just change the jQuery selector in the line below to match it.


$(".sidenav").sideNav();