Sidebar
The navigation down the side of an admin app. Ready-made variants — collapsible to icons, dark, in a color, or floating — that all turn into a drawer on phones.
Press the button to collapse each sidebar to icons, or open Products. On a phone or a narrow window the sidebar is a drawer — press the menu button.
Default
On the card color: a brand, section titles, counters, a group that opens, and the account at the bottom.
<aside class="app-sidebar" id="sidebar" popover aria-label="Main navigation">
<div class="app-sidebar-header">…brand…</div>
<nav class="app-sidebar-body">
<div class="app-nav">
<div class="app-nav-title">Overview</div>
<a class="app-nav-link active" href="/">
<i class="mi mi-house app-nav-icon"></i>
<span class="app-nav-label">Dashboard</span>
</a>
<a class="app-nav-link" href="/inbox">
<i class="mi mi-inbox app-nav-icon"></i>
<span class="app-nav-label">Inbox</span>
<span class="app-nav-badge">12</span>
</a>
<details class="app-nav-group">
<summary class="app-nav-link">
<i class="mi mi-package app-nav-icon"></i>
<span class="app-nav-label">Products</span>
</summary>
<div class="app-nav-sub">…</div>
</details>
</div>
</nav>
<div class="app-sidebar-footer">…account…</div>
</aside>
Collapsed to icons
On wide screens the sidebar can shrink to its icons to give the page more room — is-collapsed on the .app. Point at an icon to see its name. Press in the top bar of the demo to open it up again and close it back down. Any button can switch it — this one is a Toggler, which can also remember the choice for the next visit. (On phones the sidebar is a drawer instead, so this only applies from 1024px.)
<div class="app is-collapsed" id="app">…</div>
<button class="btn btn-ghost btn-icon" data-moey-toggle="#app" data-moey-toggle-class="is-collapsed"
data-moey-persist="sidebar" aria-label="Collapse the sidebar"><i class="mi mi-panel-left"></i></button>
Dark sidebar
data-mo-theme="dark" on the sidebar makes it dark on a light page — its text, counters and menus follow. (In dark mode everything is dark anyway.)
<aside class="app-sidebar" data-mo-theme="dark" …>…</aside>
In a color
Any painted area class colors it, and everything inside stays readable.
<aside class="app-sidebar theme-indigo-deep" …>…</aside>
Inset
app-sidebar-inset lifts the sidebar off the edges: a rounded panel with a gap around it, sitting on the page color — instead of a full-height strip glued to the side. It collapses to icons too (press ).
<aside class="app-sidebar app-sidebar-inset" …>…</aside>
Settings
| Class / attribute | What it does |
|---|---|
app-sidebar + popover | the sidebar: always there from 1024px, a drawer below (no JavaScript needed for it) |
app-sidebar-header · app-sidebar-body · app-sidebar-footer | brand · links (scrolls) · account |
app-nav-title · app-nav-link · app-nav-icon · app-nav-label · app-nav-badge | a section title · a link and its parts |
app-nav-group · app-nav-sub | a group that opens (a <details>) |
is-collapsed on .app | icons only, with tooltips |
app-sidebar-inset | a floating, rounded sidebar |
data-mo-theme="dark" · theme-<color>-<strength> | a dark or colored sidebar |
--mo-sidebar-width · --mo-sidebar-width-collapsed · --mo-sidebar-bg · --mo-sidebar-height | width (16rem) · collapsed width · color · height (the screen, or a box it sits in) |
The whole page around it — top bar, content, page header — is on App shell, and the dashboard example puts it all together.