domestic-ui GitHub

App shell

The frame of an application: header, primary sidebar, main content and an optional auxiliary sidebar.

Our choice: No standard defines an app shell: the landmarks <header>, <nav>, <main> and <aside>, placed with CSS grid.

Where the app shell is used The app shell is the whole frame of an app: the app bar across the top, the primary sidebar, the main content and an optional auxiliary sidebar.

Live example

<nav id="app-nav" aria-label="Main" data-nav="vertical">
  <ul>
    <li>
      <a href="?view=home">
        <!-- Lucide: house -->
        <svg data-icon xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false">
          <path d="M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8" />
          <path d="M3 10a2 2 0 0 1 .709-1.528l7-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z" />
        </svg>
        Home
      </a>
    </li>
    <li>
      <details open>
        <summary>
          <!-- Lucide: shopping-cart -->
          <svg data-icon xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false">
            <path d="m2.05 2.05 1.099-.028a1 1 0 0 1 1.008.815l2.69 14.347A1 1 0 0 0 7.83 18H18" />
            <path d="M4.563 5h16.435a1 1 0 0 1 .981 1.204l-1.026 6.226A2 2 0 0 1 18.962 14H6.25" />
            <circle cx="18" cy="20" r="2" />
            <circle cx="8" cy="20" r="2" />
          </svg>
          Sales
        </summary>
        <ul>
          <li><a href="?view=orders" aria-current="page">Orders</a></li>
          <li><a href="?view=quotes">Quotes</a></li>
          <li><a href="?view=invoices">Invoices</a></li>
        </ul>
      </details>
    </li>
    <li>
      <details>
        <summary>
          <!-- Lucide: package -->
          <svg data-icon xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false">
            <path d="M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z" />
            <path d="M12 22V12" />
            <polyline points="3.29 7 12 12 20.71 7" />
            <path d="m7.5 4.27 9 5.15" />
          </svg>
          Inventory
        </summary>
        <ul>
          <li><a href="?view=products">Products</a></li>
          <li><a href="?view=warehouses">Warehouses</a></li>
          <li><a href="?view=stock-moves">Stock moves</a></li>
        </ul>
      </details>
    </li>
    <li>
      <details>
        <summary>
          <!-- Lucide: users -->
          <svg data-icon xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false">
            <path d="M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2" />
            <path d="M16 3.128a4 4 0 0 1 0 7.744" />
            <path d="M22 21v-2a4 4 0 0 0-3-3.87" />
            <circle cx="9" cy="7" r="4" />
          </svg>
          Customers
        </summary>
        <ul>
          <li><a href="?view=accounts">Accounts</a></li>
          <li><a href="?view=contacts">Contacts</a></li>
        </ul>
      </details>
    </li>
    <li>
      <details>
        <summary>
          <!-- Lucide: chart-column -->
          <svg data-icon xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false">
            <path d="M3 3v16a2 2 0 0 0 2 2h16" />
            <path d="M18 17V9" />
            <path d="M13 17V5" />
            <path d="M8 17v-3" />
          </svg>
          Reports
        </summary>
        <ul>
          <li><a href="?view=sales-by-month">Sales by month</a></li>
          <li><a href="?view=stock-levels">Stock levels</a></li>
        </ul>
      </details>
    </li>
    <li>
      <a href="?view=settings">
        <!-- Lucide: sliders-horizontal -->
        <svg data-icon xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false">
          <path d="M10 5H3" />
          <path d="M12 19H3" />
          <path d="M14 3v4" />
          <path d="M16 17v4" />
          <path d="M21 12h-9" />
          <path d="M21 19h-5" />
          <path d="M21 5h-7" />
          <path d="M8 10v4" />
          <path d="M8 12H3" />
        </svg>
        Settings
      </a>
    </li>
  </ul>
</nav>

Auxiliary sidebar: the selected order

<aside id="app-aux" aria-label="Order details" class="stack">
  <h2 id="aux-title">Order 1042</h2>
  <p><span data-badge="accent" id="aux-status">Shipped</span></p>
  <dl>
    <dt>Customer</dt>
    <dd id="aux-customer">Analytical Engines Ltd.</dd>
    <dt>Placed</dt>
    <dd id="aux-placed"><time datetime="2025-03-12">12 Mar 2025</time></dd>
    <dt>Total</dt>
    <dd id="aux-total">€1,240.00</dd>
    <dt>Ship to</dt>
    <dd id="aux-ship">12 St James's Square, London</dd>
    <dt>Carrier</dt>
    <dd id="aux-carrier">DHL Express</dd>
  </dl>
  <p class="cluster">
    <a href="?order=1042&amp;view=edit" id="aux-open" data-button>Open order</a>
    <a href="?order=1042&amp;view=print" id="aux-print" data-button>Print</a>
  </p>
  <p role="status" class="visually-hidden" id="aux-announce"></p>
</aside>

App shell with content on the frame

<dui-app-shell data-app-shell="contained page" style="--dui-size-pane: 36rem">
  <header aria-label="Northwind reports">
    <button type="button" aria-controls="report-nav" aria-expanded="true" hidden>Menu</button>
    <a href="?view=home" data-link="quiet"><strong>Northwind</strong></a>
  </header>
  <nav id="report-nav" aria-label="Reports" data-nav="vertical">
    <ul>
      <li><a href="?report=q2">Q2 report</a></li>
      <li><a href="?report=q3" aria-current="page">Q3 report</a></li>
    </ul>
  </nav>
  <main id="main" class="stack" tabindex="-1">
    <hgroup>
      <h2>Q3 report</h2>
      <p>All regions, July to September.</p>
    </hgroup>
    <section data-card aria-labelledby="report-summary-title">
      <h3 id="report-summary-title">Summary</h3>
      <p>Revenue grew in every region. Europe led with the Bletchley Instruments renewal; the Americas recovered after a slow July.</p>
      <p>Open balances fell to €18,400, the lowest this year, after the March invoices were paid.</p>
    </section>
    <section data-card aria-labelledby="report-regions-title">
      <h3 id="report-regions-title">Regions</h3>
      <dl>
        <dt>Europe</dt>
        <dd>€214,000, up 12%</dd>
        <dt>Americas</dt>
        <dd>€158,000, up 4%</dd>
        <dt>Asia Pacific</dt>
        <dd>€97,000, up 9%</dd>
      </dl>
    </section>
    <section data-card aria-labelledby="report-next-title">
      <h3 id="report-next-title">Next quarter</h3>
      <p>Two renewals are due in October. The forecast assumes both renew at the current rate.</p>
    </section>
  </main>
</dui-app-shell>

Contained app shell

<dui-app-shell data-app-shell="contained" style="--dui-size-pane: 36rem">
  <header aria-label="Northwind">
    <button type="button" aria-controls="demo-nav" aria-expanded="true" hidden>Menu</button>
    <a href="?view=home" data-link="quiet"><strong>Northwind</strong></a>
    <button type="button" aria-controls="demo-aux" aria-expanded="true" hidden>Activity</button>
  </header>
  <nav id="demo-nav" aria-label="Main" data-nav="vertical">
    <ul>
      <li><a href="?view=home">Home</a></li>
      <li>
        <details open>
          <summary>Customers</summary>
          <ul>
            <li><a href="?view=accounts" aria-current="page">Accounts</a></li>
            <li><a href="?view=contacts">Contacts</a></li>
          </ul>
        </details>
      </li>
      <li>
        <details>
          <summary>Sales</summary>
          <ul>
            <li><a href="?view=orders">Orders</a></li>
            <li><a href="?view=invoices">Invoices</a></li>
          </ul>
        </details>
      </li>
    </ul>
  </nav>
  <main id="main" class="stack" tabindex="-1">
    <header data-page-header>
      <h2>Accounts</h2>
      <p>Customers with an open balance.</p>
      <div><a href="?view=new-account" data-button="primary">New account</a></div>
    </header>
    <div data-list-detail>
      <nav aria-label="Accounts">
        <ul>
          <li><a href="?account=c-118" aria-current="page">Analytical Engines Ltd. <small>London</small></a></li>
          <li><a href="?account=c-117">Bletchley Instruments <small>Milton Keynes</small></a></li>
          <li><a href="?account=c-116">Cobol Systems BV <small>Utrecht</small></a></li>
        </ul>
      </nav>
      <article aria-labelledby="account-118-title">
        <h3 id="account-118-title">Analytical Engines Ltd.</h3>
        <dl>
          <dt>Contact</dt>
          <dd>Ada Lovelace</dd>
          <dt>Open balance</dt>
          <dd>€1,240.00</dd>
        </dl>
      </article>
    </div>
  </main>
  <aside id="demo-aux" aria-label="Activity">
    <h2>Activity</h2>
    <ol>
      <li>Invoice INV-0318 sent, 12 March</li>
      <li>Order 1042 shipped, 12 March</li>
      <li>Payment received, 3 March</li>
    </ol>
  </aside>
</dui-app-shell>

Attributes

Attribute or valueWhereEffect
data-app-shella wrapper (or <dui-app-shell>), after the skip link
data-app-shell="contained"the shell is --dui-size-pane tall and scrolls inside its own box (a shell inside a page section)
data-app-shell="page"the page scrolls under a sticky app bar instead of main scrolling inside its panel: main sits on the frame and each data-card directly in it is a panel. Combines with contained ("contained page")

Children, in source order:

Attribute or valueEffect
<header>the app bar: app name, toggles, search, user menu
<nav aria-label> or <aside aria-label>the primary sidebar (before <main>)
<main id tabindex="-1">the content: the panel that scrolls, or with "page" the frame holding text and data-card panels
<aside aria-label>optional auxiliary sidebar (after <main>)
<footer>optional
<button type="button" aria-controls="sidebar-id" aria-expanded="true" hidden>a sidebar's toggle; <dui-app-shell> shows it. aria-expanded="false" in the markup starts the sidebar collapsed when it sits beside main. Icon only (data-button="quiet icon", Lucide panel-left or panel-right, visually hidden name) inside a <dui-tooltip> with the same words
--dui-size-sidebar, --dui-size-sidebar-auxsidebar widths beside main
--dui-size-panemax block size of a sidebar beside main; the block size of a contained shell

Scrolling

When the primary sidebar sits beside main, the shell is --dui-size-pane tall and main, the content panel, is the scroll container: the app bar, the sidebars and the footer stay where they are and only the panel's content moves. Give <main> tabindex="-1" so the skip link moves focus into it; the arrow keys and Page Up and Page Down then scroll it (WCAG 2.1.1). data-app-shell="page" opts out: main is no panel but sits on the frame with the app bar, the document scrolls, the app bar sticks to the top and main's content slides under it, and each data-card directly in main takes the panel's look, so a page can mix headings and text on the frame with one or more panels. Stacked, the document scrolls in both modes. Our choice: the panel stays put by default because an app's chrome should not move while you read its content (Linear and Vercel scroll the panel, not the page); content on the frame is the author's explicit choice. Stacked shells keep page scrolling because a nested scroller on a phone stops the browser's own toolbars from collapsing. The shell's own height follows a media query (a container query cannot style its own container); a shell narrower than the window falls back to scrolling inside its own box.

Motion

Collapsing and expanding a sidebar beside main is instant. Our choice: animating grid-template-columns re-lays out main on every frame, so tables and toolbars rewrap mid-way; a sidebar toggle is a frequent action, and frequent actions read better without motion. The drawer is dialog.css's drawer and moves like it. Elevation: the shell is a frame on --dui-color-surface-frame. When the primary sidebar sits beside main, the app bar and the sidebars sit flat on the frame with no hairlines, and main is the one floating panel: inset by --dui-space-panel-inset, --dui-radius-surface corners, the --dui-elevation-panel ring and shadow on --dui-elevation-panel-surface, and a transparent border that forced colors draw (a 1px line in the system color). Stacked, every part is flat and main is on the page surface; the drawer is at the dialog level. Our choice: one inset content panel on a quiet frame, as Linear and Vercel draw their apps, separates the chrome from the content with a single edge instead of hairlines across the whole frame; source and focus order do not change.

Breakpoints

The primary sidebar sits beside main from 48rem of the shell's own inline size, the auxiliary sidebar from 64rem (between the two it stacks under main, or is a drawer with the script). A container query condition cannot read a custom property, so both are lengths; web-components/dui-app-shell.js uses the same two numbers.

Keyboard

KeyAction
Tabskip link, app bar, primary sidebar, main, auxiliary sidebar (source order)
Enter / Spaceon a toggle, collapses or expands its sidebar; when the shell is narrow, opens it as a drawer
Escin a drawer, closes it and returns focus to its toggle

Accessibility

  • Without JavaScript both are always visible: stacked above and below main when narrow, beside it when wide.
  • Toggle buttons are native buttons with aria-controls and aria-expanded (APG Disclosure); they carry the hidden attribute in the markup and the script shows them, so there is never a button that does nothing.
  • A collapsed sidebar has the hidden attribute, so it is gone for assistive technology and the Tab order as well.
  • Sidebars that sit beside main scroll on their own; their columns run to the end of the shell and the footer sits between them, so they never cover it.
  • They are not focus traps and hold focusable links, so the keyboard reaches everything in them (WCAG 2.1.1).
  • Nothing scrolls sideways at 320px (WCAG 1.4.10): the app bar wraps, the search taking its own row.

Specifications

See also

How other systems do it

For comparison only; these are not the standard this system follows.

Search