App Layout
ProThe app shell: a sticky bar and sidebar around a scrolling page, an optional aside, banner and footer, a skip link, and drawers below a breakpoint.
Playground
Dashboard
Scroll this window: the bar and the sidebar stay where they are.
Section 1. Nora Lindgren and Daniel Okafor reviewed this block on Monday.
Section 2. Nora Lindgren and Daniel Okafor reviewed this block on Monday.
Section 3. Nora Lindgren and Daniel Okafor reviewed this block on Monday.
Section 4. Nora Lindgren and Daniel Okafor reviewed this block on Monday.
Section 5. Nora Lindgren and Daniel Okafor reviewed this block on Monday.
Dashboard
Scroll this window: the bar and the sidebar stay where they are.
Section 1. Nora Lindgren and Daniel Okafor reviewed this block on Monday.
Section 2. Nora Lindgren and Daniel Okafor reviewed this block on Monday.
Section 3. Nora Lindgren and Daniel Okafor reviewed this block on Monday.
Section 4. Nora Lindgren and Daniel Okafor reviewed this block on Monday.
Section 5. Nora Lindgren and Daniel Okafor reviewed this block on Monday.
Dashboard
Scroll this window: the bar and the sidebar stay where they are.
Section 1. Nora Lindgren and Daniel Okafor reviewed this block on Monday.
Section 2. Nora Lindgren and Daniel Okafor reviewed this block on Monday.
Section 3. Nora Lindgren and Daniel Okafor reviewed this block on Monday.
Section 4. Nora Lindgren and Daniel Okafor reviewed this block on Monday.
Section 5. Nora Lindgren and Daniel Okafor reviewed this block on Monday.
Section 6. Nora Lindgren and Daniel Okafor reviewed this block on Monday.
Section 7. Nora Lindgren and Daniel Okafor reviewed this block on Monday.
Section 8. Nora Lindgren and Daniel Okafor reviewed this block on Monday.
Dashboard
Scroll this window: the bar and the sidebar stay where they are.
Section 1. Nora Lindgren and Daniel Okafor reviewed this block on Monday.
Section 2. Nora Lindgren and Daniel Okafor reviewed this block on Monday.
Section 3. Nora Lindgren and Daniel Okafor reviewed this block on Monday.
Section 4. Nora Lindgren and Daniel Okafor reviewed this block on Monday.
Section 5. Nora Lindgren and Daniel Okafor reviewed this block on Monday.
Section 6. Nora Lindgren and Daniel Okafor reviewed this block on Monday.
Section 7. Nora Lindgren and Daniel Okafor reviewed this block on Monday.
Section 8. Nora Lindgren and Daniel Okafor reviewed this block on Monday.
Installation
App Layout comes with WunderUI Core and Pro, in the package from your plan. See the plans.
Then import what you need:
import {
AppLayout,
AppLayoutAsideTrigger,
AppLayoutNavigationTrigger,
AppLayoutProps,
} from "@wunderui/react"Then use it:
import { AppLayout, AppLayoutNavigationTrigger, Navbar, Sidebar, SidebarItem, SidebarSection } from "@wunderui/react"
import { LayoutDashboard } from "lucide-react"
export function Shell({ children }: { children: React.ReactNode }) {
return (
<AppLayout
navbar={<Navbar logo={<span className="flex items-center gap-2"><AppLayoutNavigationTrigger /><span className="text-sm font-semibold text-foreground">WunderUI</span></span>} />}
sidebar={
<Sidebar aria-label="Primary">
<SidebarSection aria-label="Main">
<SidebarItem icon={<LayoutDashboard />} label="Dashboard" href="/dashboard" active />
</SidebarSection>
</Sidebar>
}
>
{children}
</AppLayout>
)
}Expected result: You should see a top bar, a 256 px sidebar and the content beside it. Press Tab once for a Skip to content link; make the layout narrower than 64rem and the sidebar becomes a menu button.
When to use
Use App Layout for
- The frame of a signed-in product page: a sticky bar, a sidebar, the content and an optional detail panel
- A page that must work from 320 px up: the sidebar and the aside become drawers below a breakpoint
- Keyboard and screen reader basics for free: landmarks, a skip link and chrome that never covers a focused field
Regions
The layout renders the landmarks: the bar's header, the sidebar's nav, main, a named aside and a footer. A banner sits above everything and its height is measured.
Dashboard
Scroll this window: the bar and the sidebar stay where they are.
Section 1. Nora Lindgren and Daniel Okafor reviewed this block on Monday.
Section 2. Nora Lindgren and Daniel Okafor reviewed this block on Monday.
Section 3. Nora Lindgren and Daniel Okafor reviewed this block on Monday.
Section 4. Nora Lindgren and Daniel Okafor reviewed this block on Monday.
Section 5. Nora Lindgren and Daniel Okafor reviewed this block on Monday.
Dashboard
Scroll this window: the bar and the sidebar stay where they are.
Section 1. Nora Lindgren and Daniel Okafor reviewed this block on Monday.
Section 2. Nora Lindgren and Daniel Okafor reviewed this block on Monday.
Section 3. Nora Lindgren and Daniel Okafor reviewed this block on Monday.
Dashboard
Scroll this window: the bar and the sidebar stay where they are.
Section 1. Nora Lindgren and Daniel Okafor reviewed this block on Monday.
Section 2. Nora Lindgren and Daniel Okafor reviewed this block on Monday.
Section 3. Nora Lindgren and Daniel Okafor reviewed this block on Monday.
Section 4. Nora Lindgren and Daniel Okafor reviewed this block on Monday.
Section 5. Nora Lindgren and Daniel Okafor reviewed this block on Monday.
Dashed outlines are docs scaffolding. In a page the content area is the `main` landmark; here it is a plain `div` because the layout is embedded and has no skip link.
Width and padding
Contained width centres the content and steps its maximum width up from 1280 to 1620 and 2160 px on wide screens. No padding lets tables and canvases touch the edges.
Width
Dashboard
Scroll this window: the bar and the sidebar stay where they are.
Section 1. Nora Lindgren and Daniel Okafor reviewed this block on Monday.
Section 2. Nora Lindgren and Daniel Okafor reviewed this block on Monday.
Section 3. Nora Lindgren and Daniel Okafor reviewed this block on Monday.
Section 4. Nora Lindgren and Daniel Okafor reviewed this block on Monday.
Dashboard
Scroll this window: the bar and the sidebar stay where they are.
Section 1. Nora Lindgren and Daniel Okafor reviewed this block on Monday.
Section 2. Nora Lindgren and Daniel Okafor reviewed this block on Monday.
Section 3. Nora Lindgren and Daniel Okafor reviewed this block on Monday.
Section 4. Nora Lindgren and Daniel Okafor reviewed this block on Monday.
| Project | Budget |
|---|---|
| Website relaunch | $12,000 |
| Mobile app | $24,500 |
| Data platform | $31,000 |
| Billing | $8,200 |
| Onboarding | $6,400 |
| Search | $9,900 |
Drawer below
The layout reads its own width. Below the drawer breakpoint the sidebar and aside leave the layout and open as drawers from the buttons you put in the bar.
Dashboard
Scroll this window: the bar and the sidebar stay where they are.
Section 1. Nora Lindgren and Daniel Okafor reviewed this block on Monday.
Section 2. Nora Lindgren and Daniel Okafor reviewed this block on Monday.
Section 3. Nora Lindgren and Daniel Okafor reviewed this block on Monday.
This window is 720 px wide, above the breakpoint: the sidebar stays in the layout.
Dashboard
Scroll this window: the bar and the sidebar stay where they are.
Section 1. Nora Lindgren and Daniel Okafor reviewed this block on Monday.
Section 2. Nora Lindgren and Daniel Okafor reviewed this block on Monday.
Section 3. Nora Lindgren and Daniel Okafor reviewed this block on Monday.
This window is 720 px wide, below the breakpoint: the sidebar is behind the menu button and opens as a drawer.
Dashboard
Scroll this window: the bar and the sidebar stay where they are.
Section 1. Nora Lindgren and Daniel Okafor reviewed this block on Monday.
Section 2. Nora Lindgren and Daniel Okafor reviewed this block on Monday.
Section 3. Nora Lindgren and Daniel Okafor reviewed this block on Monday.
This window is 720 px wide, below the breakpoint: the sidebar is behind the menu button and opens as a drawer.
Keyboard interactions
The layout has no key handling of its own. The skip link, triggers and drawers are native links, buttons and a modal dialog, so the browser provides focus, activation and Escape.
- TaborShift+Tab
- Moves through the regions in the order of the document: the skip link, the banner, the bar, the sidebar, the content, the aside and the footer. Focus shows as an indigo border with a 2 px ring.
- Enter
- On the skip link: moves focus to the content, so the next Tab is the first control in it, and the bar is skipped. On the navigation or aside trigger: opens or toggles.
- Space
- On the navigation and aside triggers: the same as Enter.
- Esc
- In an open drawer: closes it and returns focus to the button that opened it. The aside pane has no Escape: it closes with its trigger.
Behavior and motion
How the layout measures, scrolls and switches to drawers, and what it leaves to you.
- Landmarks
- The bar is the banner landmark, sidebar sections are navs, the content is main, the aside is named by its label. Name every navigation: two unnamed ones are ambiguous.
- Skip link
- Skip to content by default. It is hidden until focused, then appears at the top left; Enter focuses the content and scrolls it clear of the sticky bar, and an embedded layout has none.
- Document scroll
- The default: the page scrolls while the bar, sidebar and aside stick. The panes scroll on their own, and anchors, printing and scroll restoration work as usual.
- Pane scroll
- The layout is as tall as the viewport and only the content scrolls, without scroll chaining. For inboxes, editors, canvases and virtualised grids.
- Chrome height
- The layout measures the banner and bar and keeps scroll padding clear of them, so an anchor or a focused field never ends up under the bar (WCAG 2.4.11). It restores everything on unmount.
- Width
- Fluid is full width. Contained centres the content at 1280 px and steps up to 1620 px from a 110rem layout and 2160 px from 150rem, following the layout's own width.
- Padding
- Comfortable is 24 px around the content, none is edge to edge. With none, give tables their own side padding.
- Drawer
- Below the drawer breakpoint (40, 48 or 64rem, default 64rem) of the layout's own width, the sidebar and aside become modal drawers over the whole page and the navigation trigger appears.
- Aside
- The pane is 320 px and open by default. Closed, it is inert and its width animates to 0; below the breakpoint it becomes a drawer, and the trigger checks what is on screen.
- Container, not window
- The layout reads its own width. The Mobile width button of a preview narrows the card to 390 px and the layout switches to drawers as on a phone, and your own container queries inside it follow.
- Hooks
- useAppLayout returns the controls of the surrounding layout, or null outside one. useRouteFocus returns a ref for the new view's heading and focuses it when its key changes, not on first render.
Motion
The layout animates one thing: the aside pane. Every transition uses the motion tokens.
- Aside pane
- The aside's width and opacity animate when it opens or closes, over the base duration.
- Drawers
- Each Sheet slides in from its edge with a blur and a scrim, and leaves faster.
- Everything else
- The layout itself does not move: the bar, the panes and the banner are laid out, not animated.
- Reduced motion
- With reduced motion on, the global rule takes moving properties out of every transition: the aside's width changes at once and only its fade remains. The drawers keep their fade.
Anatomy
The figure marks a layout with every region. The skip link, the two drawers and the triggers are listed below; the figure is an embedded layout, which has no skip link.
Dashboard
12 open tasks, 3 due this week.
- 1data-slot="app-layout"
The shell: a flex column that fills the page, with banner, navbar, a three-column grid (sidebar, content, aside) and footer. It reacts to its own width, not the window's.
- 2data-slot="app-layout-banner"Optional
A bar above everything for viewing as, offline or a trial notice. It sticks to the top in document scroll, and the layout measures its height.
- 3Optional
Usually a Navbar. It must be a direct child of the layout so it can stick, and it sits below the banner.
- Optional
An icon button that opens the navigation drawer. Visible only below the breakpoint, and renders nothing outside a layout.
- Optional
An icon button for the aside: it shows or hides the pane from the breakpoint up and opens the drawer below it. Its name follows the state: Close details, Open details.
- 4data-slot="app-layout-sidebar"Optional
Primary navigation, sticky beside the content with its own scroll. Below the breakpoint it leaves the layout and opens in a left drawer.
- 5data-slot="app-layout-main"
The main landmark, which the skip link focuses, with 24 px of padding unless you turn it off. When embedded it is a plain div.
- 6data-slot="app-layout-aside"Optional
A 320 px context panel on the right, named by its label. Closed, it is inert, shrinks to zero width and fades; below the breakpoint it opens in a right drawer.
- 7data-slot="app-layout-footer"Optional
A footer (the contentinfo landmark) under the grid, with a top border.
- Optional
The first element and the first Tab stop. It stays out of sight until focused, Enter moves focus to the content, and it is not rendered when embedded.
- Optional
A left Sheet with the sidebar, named Navigation, opened below the breakpoint. It is a modal dialog: focus moves in and stays, Escape closes it and focus returns to the trigger.
- Optional
A right Sheet with the aside, named by its label, shown below the breakpoint. Closing it closes the aside.
- data-slot="app-layout-shell"
Best practices
- Do
Pass the bar as the navbar prop, not as a child. It must be a direct child to stick, and its height feeds the sticky sidebar and aside.
- Do
Put the navigation trigger in the bar. Below the drawer breakpoint the sidebar leaves the page, and this button is the only way back to it.
- Do
Use document scroll for ordinary pages: it keeps scroll restoration, anchors, printing and sticky content. Use pane scroll only for inboxes, editors and canvases that must fill the window.
- Do
Always set the aside label when you pass an aside. The pane is a landmark and the drawer reuses the label as its title.
- Do
Call useRouteFocus with the route and put its ref on the new view's heading, so focus lands there after a route change.
- Do
Keep one logo on the screen: in the bar, next to the navigation trigger. A sidebar without a logo row is fine.
- Don’t
Don't add your own main element inside the children. The layout renders the main landmark; use embedded only for a demo inside another page, and expect no skip link there.
- Don’t
Don't add sticky chrome of your own above the layout. Use the banner: its height is measured, so the bar, panes and anchors move with it.
- Don’t
Don't read the window width to decide where the drawer starts. Set the drawer breakpoint: the layout measures itself.
API reference
AppLayout and its two triggers are plain components, so the tables list every prop. The hooks useAppLayout and useRouteFocus have their own pages.
The shell: a flex column that fills the page, with banner, navbar, a three-column grid (sidebar, content, aside) and footer. It reacts to its own width, not the window's.
| Prop | Type | Default | Description |
|---|---|---|---|
| navbar | ReactNode | — | The top bar, usually a Navbar. Rendered as a direct child so it can stick. |
| sidebar | ReactNode | — | Primary navigation, usually a Sidebar. A drawer below . |
| aside | ReactNode | — | A right-hand context panel for details, help or activity. A drawer below . |
| asideLabel | string | "Details" | The name of the aside landmark and the title of its drawer. by default. Required in practice: an unnamed aside loses its role. |
| banner | ReactNode | — | A bar above everything, such as viewing as or offline. Its height is measured. |
| footer | ReactNode | — | A under the grid with a top border. |
| scroll | "document" | "pane" | "document" | (default): the page scrolls and the chrome sticks. : the layout fills the viewport and only the content scrolls. |
| width | "fluid" | "contained" | "fluid" | (default) or : the content centres and steps 1280, 1620, 2160 px with the layout's width. |
| padding | "comfortable" | "none" | "comfortable" | (default) is 24 px around the content; is edge to edge. |
| drawerBelow | "40rem" | "48rem" | "64rem" | "64rem" | The width of the layout below which the sidebar and the aside become drawers: , or (default). |
| embedded | boolean | false | The layout is a demo inside another page: no skip link, and the content area is a instead of a second . by default. |
| asideOpen | boolean | — | Controls whether the aside is open. Uncontrolled, it starts open. |
| onAsideOpenChange | (open) => void | — | Called with the new state when the aside opens or closes. |
| children required | ReactNode | — | The content of the page, rendered inside . |
| skipLinkLabel | string | "Skip to content" | The text of the skip link, the first Tab stop. by default. |
An icon button that opens the navigation drawer. Visible only below the breakpoint, and renders nothing outside a layout.
| Prop | Type | Default | Description |
|---|---|---|---|
| label | string | "Open navigation" | The accessible name of the button. by default. |
An icon button for the aside: it shows or hides the pane from the breakpoint up and opens the drawer below it. Its name follows the state: Close details, Open details.
| Prop | Type | Default | Description |
|---|---|---|---|
| label | string | "Details" | The noun in the accessible name: or for the default. by default. |
Notes for AI
Give your coding assistant the Markdown reference instead of screenshots.
get_component("app-layout")The full library index for assistants is at /llms.txt.