Navbar
Materialize is a modern responsive CSS framework based on Material Design by Google.
Default and rounded navbars
The default navbar has square corners and no border. Use appbar for the structured app-bar layout shown throughout this page.
Default
<nav class="navbar appbar" aria-label="Default navbar example">
<div class="nav-wrapper">
<a href="index.html" class="brand-logo">Workspace</a>
<ul class="ml-auto">
<li><a href="cards.html">Cards</a></li>
<li><a href="timeline.html">Timeline</a></li>
</ul>
</div>
</nav>Rounded with padding
Add navbar-rounded for 16px corners, 4px of padding around the inner bar, and a subtle shadow. The navigation controls retain their usual height.
<nav class="navbar appbar navbar-rounded" aria-label="Rounded navbar example">
<div class="nav-wrapper">
<a href="index.html" class="brand-logo">Workspace</a>
<ul class="ml-auto">
<li><a href="cards.html">Cards</a></li>
<li><a href="timeline.html">Timeline</a></li>
</ul>
</div>
</nav>For an optional outline, add appbar-bordered. Existing navbars using that class keep their layout and border.
<nav class="navbar appbar appbar-bordered navbar-rounded">...</nav>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.
For crowded navigation, add navbar-scroll to keep one row with horizontal overflow, or
navbar-wrap to let links flow onto additional rows.
Branded app bar with right actions
Combine a logo, a visual separator, compact floating icon buttons, and a final call-to-action. The
ml-auto class keeps the action group fixed to the right edge.
Many items: wrap or horizontal scroll
Choose navbar-wrap when every link should remain visible, or
navbar-scroll when the bar should stay compact.
Wrap
Horizontal scroll
<nav class="navbar appbar navbar-scroll">
<div class="nav-wrapper">
<a href="#" class="brand-logo" aria-label="Materialize home">
<img class="brand-logo-image" src="images/materialize.svg" alt="">
<span>Materialize</span>
</a>
<span class="nav-separator" aria-hidden="true"></span>
<span class="nav-context hide-on-med-and-down">Design system</span>
<ul class="nav-actions ml-auto">
<li><a class="btn-floating" aria-label="Search"><i class="material-icons">search</i></a></li>
<li class="hide-on-small-only"><a class="btn-floating" aria-label="Notifications"><i class="material-icons">notifications</i></a></li>
<li class="nav-separator hide-on-small-only" aria-hidden="true"></li>
<li><a class="btn-floating" aria-label="Pinned items"><i class="material-icons">push_pin</i></a></li>
<li class="hide-on-med-and-down"><a class="btn filled rounded icon-right appbar-create">Create <i class="material-icons">add</i></a></li>
</ul>
</div>
</nav>Scrolling styles are included in kmaterialize. Initialize the edge fades with the library helper; call the returned function when removing the navbar.
import { initNavbarScroll } from 'kmaterialize';
const dispose = initNavbarScroll(document.querySelector('.navbar-scroll'));
// When unmounting: dispose();Left Aligned Links
Links sit at the left by default, since .nav-wrapper is a flex row and they're the
first thing after the logo in source order. To push the logo itself to the right instead and keep the links at
the left, put the ul before the logo in the markup and add
ml-auto to the logo.
<nav class="navbar appbar">
<div class="nav-wrapper">
<ul id="nav-mobile" class="hide-on-med-and-down">
<li><a href="sass.html">Sass</a></li>
<li><a href="badges.html">Components</a></li>
<li><a href="collapsible.html">JavaScript</a></li>
</ul>
<a href="#" class="brand-logo ml-auto"><img class="brand-logo-image" src="images/materialize.svg" alt="" /><span>Materialize</span></a>
</div>
</nav>Centering the logo
The logo will center itself on medium and down screens, but if you want the logo to always be centered, add the center class to
your
<a class="brand-logo"></a>
. You will have to make sure yourself that links do not overlap if you use this.
<nav class="navbar appbar">
<div class="nav-wrapper nav-wrapper-centered">
<a href="#" class="brand-logo center"><img class="brand-logo-image" src="images/materialize.svg" alt="" /><span>Materialize</span></a>
<ul id="nav-mobile" class="left hide-on-med-and-down">
<li><a href="sass.html">Sass</a></li>
<li><a href="badges.html">Components</a></li>
<li><a href="collapsible.html">JavaScript</a></li>
</ul>
</div>
</nav>Active Items
Add active class to your li tags to denote the current page.
<nav class="navbar appbar">
<div class="nav-wrapper nav-wrapper-centered">
<a href="#!" class="brand-logo center"><img class="brand-logo-image" src="images/materialize.svg" alt="" /><span>Materialize</span></a>
<ul class="left hide-on-med-and-down">
<li><a href="sass.html">Sass</a></li>
<li><a href="badges.html">Components</a></li>
<li class="active"><a href="collapsible.html">JavaScript</a></li>
</ul>
</div>
</nav>Icon Links
You can add icons into links. For icon only links you don't need any additional class. Just pop the i tag in and it will work.
<nav class="navbar appbar">
<div class="nav-wrapper">
<a href="#!" class="brand-logo"><img class="brand-logo-image" src="images/materialize.svg" alt="" /><span>Materialize</span></a>
<ul class="ml-auto hide-on-med-and-down">
<li><a href="sass.html"><i class="material-icons">search</i></a></li>
<li><a href="badges.html"><i class="material-icons">view_module</i></a></li>
<li><a href="collapsible.html"><i class="material-icons">refresh</i></a></li>
<li><a href="mobile.html"><i class="material-icons">more_vert</i></a></li>
</ul>
</div>
</nav>
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 class="navbar appbar">
<div class="nav-wrapper">
<a href="#!" class="brand-logo"><img class="brand-logo-image" src="images/materialize.svg" alt="" /><span>Materialize</span></a>
<ul class="ml-auto hide-on-med-and-down">
<li><a href="sass.html"><i class="material-icons left">search</i>Link with Left Icon</a></li>
<li><a href="badges.html"><i class="material-icons right">view_module</i>Link with Right Icon</a></li>
</ul>
</div>
</nav>