App Shell

Free

The frame of a dashboard: a collapsible sidebar, a top bar, the page and a footer — slot-based, with the collapsed and mobile-overlay state shared by the parts without a single binding.

</>sv-dashboard-shell app shelllayoutsidebartopbarheaderfooterdashboardadmin
import { SvDashboardShellComponent } from '@styloviz/layout/dashboard-shell';

Demo & usage

Basic usage

Usage example — open the gallery for the full interactive demo.

An interactive demo for this component lives in the gallery.

Open live demo

More examples

Sidebar (shell)

example.htmlAngular
<!-- The collapsible container: a brand row, your navigation, a pinned footer.
     Inside a shell it follows the shell's collapsed / mobileOpen state. -->
<sv-sidebar svShellSidebar label="Main navigation">
  <a svSidebarBrand routerLink="/">Acme</a>
  <nav aria-label="Primary">…</nav>
  <span svSidebarFooter>v3.1</span>
</sv-sidebar>

Sidebar Nav (tree)

example.htmlAngular
<!-- The navigation tree inside it: groups, sub-navigation, the active trail
     and the rail. Its own chrome and drawer are off — the sidebar is both. -->
<sv-sidebar svShellSidebar>
  <sv-sidebar-nav [menuGroups]="nav" [activeRoute]="router.url" [collapsed]="shell.collapsed()"
                  [showHeader]="false" [showFooter]="false" [mobileBreakpoint]="0" />
</sv-sidebar>

Page header with actions

example.htmlAngular
<sv-page-header title="Orders" subtitle="1,284 this month">
  <sv-button variant="secondary" label="Export" />
  <sv-button label="New order" />
</sv-page-header>

Persist the collapsed rail

example.htmlAngular
<!-- collapsed and mobileOpen are models: bind them to keep the rail across reloads -->
<sv-dashboard-shell [(collapsed)]="railed">…</sv-dashboard-shell>

Embedded in a page or preview

example.htmlAngular
<!-- contained: fill the container, not the viewport -->
<div class="h-[480px]">
  <sv-dashboard-shell [contained]="true">…</sv-dashboard-shell>
</div>

Skip link

example.htmlAngular
<!-- On by default: the first Tab stop is "Skip to main content", which moves focus to <main>.
     Rename it, or turn it off when the page renders its own. -->
<sv-dashboard-shell skipLinkLabel="Skip to orders">…</sv-dashboard-shell>
<sv-dashboard-shell [skipLink]="false">…</sv-dashboard-shell>

A layout without a sidebar

example.htmlAngular
<sv-dashboard-shell>
  <sv-topbar svShellTopbar [showSidebarToggle]="false"><span topbar-start>Acme</span></sv-topbar>
  <router-outlet />
</sv-dashboard-shell>

Page header with navigation and responsive actions

example.htmlAngular
<!-- With a breadcrumb, back/up or tabs slot the header is ONE region landmark named
     by its title. [actions] fold into the toolbar's "More actions" menu when the row
     runs out of room; projected buttons render beside them. -->
<sv-page-header title="Order #1042" subtitle="Placed 3 March" [actions]="actions" (actionClick)="run($event)">
  <sv-back-up svPageHeaderBack mode="up" [up]="'/orders'" upLabel="Orders" size="sm" />
  <sv-breadcrumb svPageHeaderBreadcrumb [items]="trail" />
  <span svPageHeaderMeta>Paid</span>
  <sv-button label="Refund" />
  <sv-tabs svPageHeaderTabs [tabs]="tabs" size="sm" />
</sv-page-header>

When to use

  • The outer frame of an admin panel, a SaaS dashboard or an internal tool: navigation on the side, actions on top, the page in between.
  • You want the collapsed rail and the small-screen overlay handled once, for every page, instead of per page.
  • Use `sv-page-header` at the top of each routed page for its title, subtitle and primary actions.
  • Sidebar (shell) · Sidebar Nav (tree): `sv-sidebar` is the collapsible container, and Sidebar Nav (`sv-sidebar-nav`, a variant of this family) is the navigation tree you put inside it.
  • Compare with Site Footer: `sv-footer` is the one-line bar inside the shell; `sv-site-footer` is the multi-column marketing footer.

Async states

None — this component has nothing to load, so it has no loading, empty or error state to drive.

Inputs

NameTypeDefaultDescription
collapsedboolean (two-way)falseDesktop: the sidebar is collapsed to its icon rail. Two-way.
mobileOpenboolean (two-way)falseSmall screens: the sidebar is open as an overlay. Two-way.
containedbooleanfalseFill the container instead of the viewport, for a shell embedded in a page.
skipLinkbooleantrueRender the "Skip to main content" link (WCAG 2.4.1 Bypass Blocks) as the shell's first focusable element. Turn it off only when the page already renders its own skip link — two would be one too many.
skipLinkLabelstring'Skip to main content'Text of the skip link.

Outputs

EventPayload typeDescription
collapsedChangebooleanEmits the new `collapsed` whenever it changes — the output half of `[(collapsed)]`.
mobileOpenChangebooleanEmits the new `mobileOpen` whenever it changes — the output half of `[(mobileOpen)]`.

<sv-sidebar>

Also in this family — SvSidebarComponent from @styloviz/layout.

Async states

None — this component has nothing to load, so it has no loading, empty or error state to drive.

Inputs

NameTypeDefaultDescription
collapsedbooleanfalseCollapsed to the icon rail (desktop). Ignored inside `sv-dashboard-shell`, which owns it.
mobileOpenbooleanfalseOpen as an overlay (small screens). Ignored inside `sv-dashboard-shell`, which owns it.
labelstring'Main navigation'Accessible name of the panel.

Outputs

EventPayload typeDescription
mobileClosevoidEmits when the overlay should close: a link inside it was activated, or Escape was pressed.

<sv-topbar>

Also in this family — SvTopbarComponent from @styloviz/layout.

Async states

None — this component has nothing to load, so it has no loading, empty or error state to drive.

Inputs

NameTypeDefaultDescription
sidebarCollapsedbooleanfalseWhether the sidebar is collapsed, for the toggle's icon and pressed state. Ignored inside `sv-dashboard-shell`.
showSidebarTogglebooleantrueRender the sidebar toggles. Set false for a layout without a sidebar.
showThemeTogglebooleantrueRender the light/dark toggle.
openSidebarLabelstring'Open sidebar'Accessible name of the small-screen hamburger.
expandSidebarLabelstring'Expand sidebar'Accessible name of the desktop toggle while the sidebar is collapsed.
collapseSidebarLabelstring'Collapse sidebar'Accessible name of the desktop toggle while the sidebar is expanded.
lightModeLabelstring'Switch to light mode'Accessible name of the theme toggle in dark mode.
darkModeLabelstring'Switch to dark mode'Accessible name of the theme toggle in light mode.

Outputs

EventPayload typeDescription
toggleSidebarvoidEmits when the desktop sidebar toggle is activated.
toggleMobileSidebarvoidEmits when the small-screen hamburger is activated.

<sv-page-header>

Also in this family — SvPageHeaderComponent from @styloviz/layout.

Async states

None — this component has nothing to load, so it has no loading, empty or error state to drive.

Inputs

NameTypeDefaultDescription
titlerequiredstring—Page title
subtitlestring''Optional subtitle / description
actionsreadonly PageHeaderAction[][]Actions for the responsive actions row, rendered through `sv-toolbar` with `overflow="menu"`: what does not fit the row folds into a "More actions" menu. Projected buttons (the default slot) render beside them.
actionsLabelstring'Page actions'Accessible name of the actions row.

Outputs

EventPayload typeDescription
actionClickstringEmits the `id` of the action chosen from the actions row or its overflow menu.

Customization & theming

  • Slots: `[svShellSidebar]`, `[svShellTopbar]`, the default slot (the page), `[svShellFooter]`. A shell with no sidebar takes no left offset.
  • `sv-sidebar`: `[svSidebarBrand]` (the 64 px brand row), the default slot (navigation) and `[svSidebarFooter]` (pinned to the bottom); `w-64` expanded, a `w-20` rail collapsed from `lg` up, an overlay below it.
  • `sv-topbar`: the sidebar toggles, then `[topbar-start]`, `[topbar-search]` (the flexible middle), `[topbar-actions]`, then the theme toggle. `showSidebarToggle` and `showThemeToggle` turn the built-in controls off.
  • `sv-footer`: the default slot (start) and `[svFooterEnd]` (end); stacked on small screens.
  • Every surface uses the theme tokens with a `dark:` counterpart; the sidebar and topbar are glass because the page scrolls beneath them.
  • `sv-page-header`: `title` and `subtitle`; slots `[svPageHeaderBack]` and `[svPageHeaderBreadcrumb]` above the title, `[svPageHeaderMeta]` beside it, `[svPageHeaderTabs]` along the bottom edge, the default slot for actions; `actions` (+ `actionClick`, `actionsLabel`) for a responsive actions row that folds into the toolbar's overflow menu. Import the slot directives (`SvPageHeaderBreadcrumbDirective`, …) so the header knows it holds page navigation.

Best practices

  • Do: Put your `<router-outlet />` in the shell's default slot: it is the scrolling region, so the topbar stays put while the page scrolls.
  • Do: Let the shell own the state. A projected `sv-sidebar` and `sv-topbar` read and drive it through `SV_SHELL_CONTEXT`; bind `[(collapsed)]` only when you need to persist or set it.
  • Do: Pass a nav component's own collapsed input from the shell (`[collapsed]="shell.collapsed()"`) so the tree and the rail agree, and turn its own mobile drawer off (`[mobileBreakpoint]="0"`) — the sidebar already is one.
  • Don't: Don't nest a shell inside a page that already has one; use `contained` only for a shell embedded on purpose (a preview, a docs page, a panel).
  • Tip: Toasts are not part of the shell: add the `<sv-toast-host>` positions you use next to it.
  • Do: Keep the built-in skip link (on by default). If the page already renders its own "Skip to content" link, set `[skipLink]="false"` — two skip links in a row are one too many.

Accessibility

  • Landmarks: the sidebar is a `complementary` region named by `label` (default "Main navigation"), the topbar a `banner`, the page `main`, the footer `contentinfo`. Put a named `<nav>` inside the sidebar.
  • The desktop toggle reports `aria-pressed` and is named for what it will do ("Collapse sidebar" / "Expand sidebar"); the hamburger and the theme toggle are named too, and every name is an input for translation.
  • The small-screen overlay closes on Escape, on its backdrop (hidden from assistive technology) and when a link inside the sidebar is followed.
  • Collapsed, the navigation is the nav component's job: `sv-sidebar-nav` keeps every item named in its rail.
  • Skip link (WCAG 2.4.1): the shell's first focusable element is a "Skip to main content" link, visually hidden until it takes focus. Activating it moves focus to `<main>` (which has `tabindex="-1"`), so the next Tab continues inside the page instead of walking the sidebar and topbar again. Its text comes from the `layout` label pack (`skipToMainContent`, all 12 languages); `skipLinkLabel` overrides it, `skipLink` turns it off, and `focusMain()` lets a host shortcut do the same move.
  • RTL: the sidebar is pinned to the inline start (`start-0`, border on the inline end) and the content is offset with `margin-inline-start`, so under `dir="rtl"` the sidebar is on the right and the page makes room on the right; the small-screen overlay slides off to the right.
  • `sv-page-header`: the title is the page `<h1>`. With a breadcrumb, back/up or tabs slot in use the header is one `region` landmark named by that title, so the page's own navigation sits in one place; a plain header adds no landmark. The actions row is a named `toolbar` ("Page actions") whose overflow is the kit's keyboard-operable "More actions" menu.

Feedback on App Shell

Spotted a gap in this page, or something that didn't work as described? Comments are GitHub Discussions in the public styloviz/community repo, so posting needs a GitHub account.

Loads giscus.app and GitHub — nothing is fetched until you click.