Skip to content
WunderUI

App Layout

Pro

The 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

WunderUI

Dashboard

Scroll this window: the bar and the sidebar stay where they are.

Revenue$48,210
Active users2,840
Open tasks17

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.

Installation

App Layout comes with WunderUI Core and Pro, in the package from your plan. See the plans.

Then import what you need:

tsx
import {
  AppLayout,
  AppLayoutAsideTrigger,
  AppLayoutNavigationTrigger,
  AppLayoutProps,
} from "@wunderui/react"

Then use it:

tsx
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

Use something else for

  • Navbar for the top bar alone, for a site without a sidebar
  • Sidebar for the navigation column that goes into this layout
  • Sheet for a panel that opens over a page you build yourself

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.

You are viewing the workspace as Nora Lindgren.
WunderUI

Dashboard

Scroll this window: the bar and the sidebar stay where they are.

Revenue$48,210
Active users2,840
Open tasks17

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.

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

WunderUI

Dashboard

Scroll this window: the bar and the sidebar stay where they are.

Revenue$48,210
Active users2,840
Open tasks17

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.

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.

WunderUI

Dashboard

Scroll this window: the bar and the sidebar stay where they are.

Revenue$48,210
Active users2,840
Open tasks17

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.

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.

TaborShiftTab
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.

You are viewing the workspace as Nora Lindgren.
WunderUI

Dashboard

12 open tasks, 3 due this week.

WunderUI · info@wunderui.com

  • data-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.

  • data-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.

  • Optional

    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.

  • data-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.

  • data-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.

  • data-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.

  • data-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.

PropTypeDefaultDescription
navbarReactNode—The top bar, usually a Navbar. Rendered as a direct child so it can stick.
sidebarReactNode—Primary navigation, usually a Sidebar. A drawer below .
asideReactNode—A right-hand context panel for details, help or activity. A drawer below .
asideLabelstring"Details"The name of the aside landmark and the title of its drawer. by default. Required in practice: an unnamed aside loses its role.
bannerReactNode—A bar above everything, such as viewing as or offline. Its height is measured.
footerReactNode—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).
embeddedbooleanfalseThe layout is a demo inside another page: no skip link, and the content area is a instead of a second . by default.
asideOpenboolean—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 requiredReactNode—The content of the page, rendered inside .
skipLinkLabelstring"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.

PropTypeDefaultDescription
labelstring"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.

PropTypeDefaultDescription
labelstring"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.

MCPget_component("app-layout")
InstallIncluded in Core and Pro

The full library index for assistants is at /llms.txt.