Shell and sidebar
Two layouts for application screens. iv-sidebar puts a side column next to the content and stacks the two when the content would get too narrow — decided by the room the block has, not by the width of the window, so the same markup works in a page, a card or a dialog. iv-shell is a whole application frame: a sticky glass bar across the top, a side column that is sticky from the lg breakpoint, and the main area; below lg the column folds away and a drawer inside it becomes the menu.
Couldn't load the demo. Open alone — App shell with a sidebar inside the main area
<div class="iv-stack iv-u-gap-6">
<div class="iv-shell" style="min-block-size: 30rem; border: 1px solid var(--iv-color-border); border-radius: var(--iv-radius-lg); overflow: clip">
<header class="iv-shell__top">
<a class="iv-button iv-button--ghost iv-button--icon iv-u-lg-hidden" href="#shell-nav" data-iv-open="shell-nav" aria-label="Open navigation">
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true"><path d="M4 7h16M4 12h16M4 17h16"/></svg>
</a>
<strong>Console</strong>
<span class="iv-badge iv-badge--primary">Sample</span>
</header>
<aside class="iv-shell__side" aria-label="Console navigation">
<dialog class="iv-drawer" id="shell-nav" data-iv-component="drawer" data-iv-static-from="lg" aria-label="Console navigation">
<div class="iv-drawer__panel">
<div class="iv-drawer__body">
<ul class="iv-list iv-list--flush" aria-label="Sections">
<li class="iv-list__item"><a class="iv-list__action" href="#shell-note" aria-current="page">Overview</a></li>
<li class="iv-list__item"><a class="iv-list__action" href="#shell-note">Deploys</a></li>
<li class="iv-list__item"><a class="iv-list__action" href="#shell-note">Domains</a></li>
<li class="iv-list__item"><a class="iv-list__action" href="#shell-note">Settings</a></li>
</ul>
</div>
</div>
</dialog>
</aside>
<main class="iv-shell__main">
<div class="iv-sidebar iv-sidebar--end">
<div class="iv-stack iv-u-gap-3">
<h3 class="iv-u-m-0">Overview</h3>
<p class="iv-u-m-0 iv-u-text-muted">The main column takes the room; the panel beside it keeps 14rem and drops under the content when the column gets narrow, without a breakpoint.</p>
</div>
<aside class="iv-card" style="--iv-sidebar-width: 14rem" aria-label="Status">
<div class="iv-card__body iv-stack iv-u-gap-2">
<strong>Status</strong>
<span class="iv-badge iv-badge--success">All systems operational</span>
</div>
</aside>
</div>
</main>
</div>
<p class="iv-u-m-0 iv-u-text-sm iv-u-text-muted" id="shell-note">Demo frame: the navigation leads back to this note. From the lg breakpoint the drawer is the side column; below it, the menu button opens it as a modal.</p>
</div>.iv-root {
--iv-sidebar-width: 14rem;
}// data-iv-component="drawer"
{
open: "shell-nav",
staticFrom: "lg",
}The sidebar layout
<div class="iv-sidebar">
<aside>…</aside> <!-- keeps --iv-sidebar-width -->
<div>…</div> <!-- takes the rest -->
</div>Two children. The side keeps --iv-sidebar-width (16rem) and the content takes what is left; when the content would fall under --iv-sidebar-min of the container, both wrap and stack, with the side on top. iv-sidebar--end puts the side column after the content, as the status card in the example. The technique is flex wrapping with a huge grow factor on the content — no media query and no container query, which is why it nests anywhere. Use it for a filter column beside results, an aside beside an article, or a settings menu beside its form.
The application shell
<div class="iv-shell">
<header class="iv-shell__top">…menu button, product name…</header>
<aside class="iv-shell__side" aria-label="Console navigation">
<dialog class="iv-drawer" id="nav" data-iv-component="drawer"
data-iv-static-from="lg" aria-label="Console navigation">…</dialog>
</aside>
<main class="iv-shell__main">…</main>
</div>From lg the drawer is static: it renders in place as the side column, sticky under the bar and as tall as the viewport. Below lg the column takes no room, the menu button in the bar (data-iv-open="nav", hidden from lg with iv-u-lg-hidden) opens the same drawer as a modal, and focus, Escape and the backdrop work as on any drawer. One navigation in the source, two presentations, no duplicated markup.
Accessibility
- Name the landmarks: the side column is an
<aside>with anaria-label, the content is the page's single<main>. Inside a page that already has a<main>, use a<div class="iv-shell__main">instead. - Mark the current section with
aria-current="page"; the navigation list styles it. - Without JavaScript the menu button is still a link to the drawer's id: following it shows the drawer through
:targetas a static block, so the navigation stays reachable (see drawer). - The top bar keeps a solid edge in forced colours, where its glass blur is dropped.
Customising
.console {
--iv-shell-side: 18rem;
--iv-shell-top: 4rem;
}
.filters { --iv-sidebar-width: 14rem; --iv-sidebar-min: 55%; --iv-sidebar-gap: var(--iv-space-8); }Shell locals: --iv-shell-side (16rem, the column width from lg) and --iv-shell-top (3.75rem, the bar height the column sticks under). Sidebar locals: --iv-sidebar-width, --iv-sidebar-min and --iv-sidebar-gap; set the width on the side child itself when one sidebar needs a different column, as the example does.
Common mistakes
- Two navigations in the source, one for desktop and one for mobile: screen readers find both.
- A static drawer outside
asideornav: the drawer warns about it in development. - Nesting an
iv-shellinside another, or a<main>inside a<main>. - Giving the sidebar child a fixed width with a utility instead of the local, which stops it from wrapping.
Class index
Every class of the two families. The full list per stylesheet lives in the reference.
| Class | What it does |
|---|---|
iv-sidebar | Side column and content that stack by available width. |
iv-sidebar--end | Side column after the content. |
iv-shell | Application frame. |
iv-shell__top | Sticky glass top bar. |
iv-shell__side | Side column from lg; holds a static drawer. |
iv-shell__main | The main area. |