Components
Navbar
The top bar for sites and apps without the sidebar shell: brand, links and actions. On phones and tablets the links fold into a ☰ button that opens a floating panel — automatically.
Sub-links, search & more
<header class="navbar">
<a class="navbar-brand" href="./"><img src="logo.svg" alt=""> Moey</a>
<button class="navbar-toggle"></button> <!-- the ☰ button: shown when the bar folds -->
<div class="navbar-collapse">
<nav class="nav">
<a href="./" aria-current="page">Dashboard</a>
<a href="/orders">Orders</a>
</nav>
<div class="navbar-actions">
<a class="btn btn-default" href="/signup">Get started</a>
</div>
</div>
</header>
<!-- Sub-links: a dropdown in the nav -->
<div class="dropdown">
<button class="nav-link dropdown-toggle">Components</button>
<div class="menu">
<a class="menu-item" href="/buttons"><i class="mi mi-mouse-pointer-click"></i>
<span class="menu-item-content">Buttons<span class="menu-item-detail">Solid, subtle, outline</span></span></a>
</div>
</div>
<!-- Search -->
<div class="navbar-search form-adorn">
<i class="mi mi-search adorn-start"></i>
<input class="form-control form-filled" type="search" placeholder="Search…">
</div>
- Folding — below 1024px the
.navbar-collapsehides and the.navbar-toggleappears; it opens a floating panel under the bar with the links stacked and the actions full-width. Tap outside, press Esc or follow a link to close it..navbar-expand-mdfolds below 768px instead;.navbar-expandnever folds. - Sub-links — put a dropdown in the nav (icons and a second line with
.menu-item-content+.menu-item-detailwork great). On desktop it floats; in the phone panel it opens inline under its link, like an accordion — same markup. - Search —
<div class="navbar-search form-adorn">with a search icon and a.form-control. It sits before the actions in the bar and moves to the top of the phone panel, full width. - Actions — icon buttons (a bell with a
.badge-corner), an avatar dropdown, sign-in buttons… In the phone panel text buttons share the row; icon buttons keep their size. - Width — put a
.containerinside to line the content up with the page.
| Class | What it does |
|---|---|
| (default) | A flat surface |
.navbar-transparent | No background — over a hero image or colored header |
.navbar-blur | Frosted glass: see-through with a blur (great with sticky) |
.navbar-floating | An inset, rounded bar |
.navbar-vivid · .navbar-deep + .navbar-<color> | Filled with the color (*-600, or a dark *-800); links and ghost buttons turn light. Give buttons their own theme-* if needed. |
.navbar-sticky | Stays at the top; gets a soft shadow once the page scrolls |
.navbar-expand-md · .navbar-expand | Fold below 768px · never fold |
On phones
Each one below is a real phone-sized page — tap ☰. Pick where ☰ sits by where you put it, keep the most important action in the bar by placing its .navbar-actions outside the .navbar-collapse, and pick how the menu opens with one class. Full-height menus put the buttons at the bottom, within thumb reach, and hold the page still while open.
<!-- ☰ at the start: put it first -->
<header class="navbar">
<button class="navbar-toggle" aria-label="Menu"></button>
<a class="navbar-brand" href="/">Moey</a>
<div class="navbar-collapse">…</div>
</header>
<!-- Brand in the middle, the avatar stays in the bar -->
<header class="navbar navbar-center">
<button class="navbar-toggle" aria-label="Menu"></button>
<a class="navbar-brand" href="/">Moey</a>
<div class="navbar-collapse">…</div>
<div class="navbar-actions">
<span class="avatar avatar-sm">JD</span>
</div>
</header>
<!-- How the menu opens -->
<header class="navbar navbar-full">…</header> <!-- the whole screen under the bar -->
<header class="navbar navbar-drawer">…</header> <!-- a side sheet from the end -->
<header class="navbar navbar-drawer-start">…</header> <!-- a side sheet from the start -->
| On phones | What it does |
|---|---|
.navbar-toggle first | ☰ sits at the start, the brand after it (otherwise ☰ is at the end) |
.navbar-center | The brand sits in the middle of the folded bar |
.navbar-actions outside the collapse | Stays in the bar on phones (an avatar, a cart, one key button); on wide screens it sits at the end as usual |
| (default) | The menu opens as a floating card under the bar |
.navbar-full | The menu fills the screen under the bar, with bigger links |
.navbar-drawer · .navbar-drawer-start | The menu slides in from the end · the start (flips in right-to-left), and dims the page |
With a user menu
Notifications and the signed-in person on the right.
<header class="navbar navbar-expand">
<a class="navbar-brand" href="#navbar"><img src="../brand/moey-icon.svg" alt="">Moey Admin</a>
<div class="navbar-collapse">
<nav class="nav">
<a href="#navbar" aria-current="page">Orders</a>
<a href="#navbar">Products</a>
<a href="#navbar">Reports</a>
</nav>
<div class="navbar-actions">
<button class="btn btn-gray btn-ghost btn-icon" aria-label="Notifications">
<i class="mi mi-bell"></i>
</button>
<div class="dropdown">
<button class="btn btn-gray btn-ghost px-1">
<span class="avatar avatar-sm">JD</span>
</button>
<div class="menu" data-moey-placement="bottom-end">
<div class="menu-header">Jane Doe · jane@moey.test</div>
<a class="menu-item" href="#navbar"><i class="mi mi-user"></i>Profile</a>
<a class="menu-item" href="#navbar"><i class="mi mi-settings"></i>Settings</a>
<div class="menu-divider"></div>
<button class="menu-item theme-red"><i class="mi mi-log-out"></i>Sign out</button>
</div>
</div>
</div>
</div>
</header>
Sticky to the top
Keep it in view while the page scrolls.
<header class="navbar navbar-sticky">…</header>