Sidebar
Use data-sidebar-layout on a container (typically <body>) with <aside data-sidebar> for the sidebar and <main> for content. The sidebar stays sticky while the main content scrolls. On mobile, the sidebar becomes a slide-out overlay toggled by a [data-sidebar-toggle] button.
With top sticky nav
Add data-topnav to a header element for a full-width top navigation bar. The sidebar will adjust to sit below it.
<body data-sidebar-layout>
<nav data-topnav>
<button data-sidebar-toggle aria-label="Toggle menu" class="outline">☰</button>
<span>App Name</span>
</nav>
<aside data-sidebar>
<header>Logo</header>
<nav>...navigation...</nav>
<footer>Actions</footer>
</aside>
<main>
Main page content.
</main>
</body>
Structure
| Attribute | Element | |
|---|---|---|
data-sidebar-layout | Container | Grid layout wrapper (sidebar + main), typically <body> |
data-topnav | <header> | Full-width top nav (optional, spans full width) |
data-sidebar | <aside> | Sticky sidebar element |
data-sidebar-toggle | <button> | Toggles sidebar visibility on mobile |
data-sidebar-open | Layout | Applied to layout when sidebar is open |