App shell
The frame every product screen starts from — rail, top bar, page padding.
{/* Generated by scripts/build-component-docs.mjs — do not edit. The source is the component folder: guidance.json, the doc block and the props. Change those. */}
The frame every product screen starts from — rail, top bar, page padding.
Import
import { AppShell, AppShellMain, AppShellHeader, AppShellContent } from "@ir/ui";Variants
| Axis | Options | Default |
|---|---|---|
width | fluid · standard · reading | fluid |
Do and don't
Keep it to the sidebar toggle and the breadcrumb; the page header lives in the content area.
Don't — Put the page title, search and page actions in the top bar.
The bar is 48 high and it is the same bar on every screen. Everything added to it competes with the breadcrumb, which is the one thing that tells you where you are.
Default to expanded from lg (1024) up, and to collapsed only at md (768) where the content would drop under 720.
Don't — Ship the rail collapsed to win back 208px.
An icon-only rail is a memory test for anyone who does not already know the product. The width is worth more to the person than to the layout.
Trust the named step — xl: is 1280 in the tokens, in Tailwind and in the class.
Don't — Re-derive the breakpoint from a screen width quoted in a spec.
IR's ladder used to be Tailwind's shifted up one, so lg: meant 1280 to a designer and 1024 to the browser. They are one ladder now, and the name is the thing to trust.
Let a dashboard add columns as it widens.
Don't — Stretch four tiles across a wide screen.
A KPI tile stretched to 500 wide carries the same number in twice the space, and the eye has further to travel between them. On a fluid page the spare width becomes more tiles per row — an auto-fill grid with a 224 minimum — and charts go from one across to two at 768 of content and three at 1280.
Cap forms and prose at the reading width.
Don't — Let a field span the content area.
A 1600-wide text field gives no sense of what length of answer is expected, and a line of prose that long is hard to track back to its start. width="reading" caps the column at 768 (size/content/reading).
Keep capped content aligned to the rail.
Don't — Centre capped content.
Centring moves the start of every line as the window resizes, and breaks the alignment with the rail and the breadcrumb above it. Left-aligned, the page heading starts in the same place whether the page is fluid, standard or reading.
Size dashboard grids to their container.
Don't — Use viewport breakpoints inside the content area.
The viewport does not know about the rail, the padding, a cap or a drawer. The same grid sits in a 976 column at 1280 with the rail open and a 1184 one with it collapsed. Use the @-variants (@3xl:, @7xl:); viewport breakpoints are for the shell — rail collapse and padding.
Give charts a fixed height range.
Don't — Lock a chart to an aspect ratio.
An aspect ratio makes a chart grow taller as the screen widens, so on a 2560 monitor one chart fills the screen and pushes everything under it out of view. Width is where the extra time range goes; height stays between 240 and 320.
Keep the scroll in the content area so the rail and the top bar stay put.
Don't — Let the shell scroll as well as the page.
Two scrollbars is the most common app-shell bug and the hardest to notice in a screenshot: the top bar slides away and the breadcrumb goes with it.
Accessibility
- AppShellMain is a plain <div>, never <main>. It contains the top bar, and chrome inside the main landmark both pollutes it and strips the <header> of its banner role — a <header> carries that role only when it is not inside main, aside, nav or section.
- AppShellHeader is the <header> and therefore the page's banner; AppShellContent is the document's <main>. One of each per page.
Where it is drawn
Figma — structure from figma, measurements from figma.