App Shell
Full-page layout that puts a TopBar, a Sidebar and a scrolling content area into one frame, with a mobile sidebar toggle and an optional table-of-contents rail.
<arc-app-shell>Overview
AppShell is the page frame for an app: a fixed top bar, a collapsible sidebar and a scrolling main area. Put an arc-top-bar in the topbar slot, an arc-sidebar (or any nav markup) in sidebar, and the page content in the default slot. The sidebar and the toc rail stick below the top bar and scroll on their own.
At 900 px and below (the breakpoint prop, default navCollapse), the sidebar collapses out of view, and the sidebar-open attribute brings it back. A fourth slot, toc, is a right-hand rail for a table of contents or other side content. It hides at 1280 px and below.
Guidelines
Do
- Use one AppShell as the root layout of each page or route
- Put a button in the top bar that sets sidebar-open on small screens
- Use the "toc" slot for the table of contents on documentation pages
- Use Container or Section inside the default slot to set content widths
Don't
- Don't put scrolling content in the sidebar slot without giving it its own overflow
- Don't put anything users need in the toc slot. It hides on narrower screens
- Don't override the min-height to fit a shell inside a card or preview. Set `embedded`
- Don't use AppShell for marketing pages with no persistent sidebar or top bar
Features
- At least `100vh` tall by default, so the shell fills the screen
Preview
Usage
Its events and state need JavaScript, so use the Web Component or a framework wrapper for those.
<script type="module" src="@arclux/arc-ui"></script>
<arc-app-shell>
<arc-top-bar slot="topbar" heading="Dashboard"></arc-top-bar>
<nav slot="sidebar" style="width: 200px; padding: 16px;">
<a href="/overview">Overview</a>
<a href="/analytics">Analytics</a>
<a href="/settings">Settings</a>
</nav>
<main>
<h1>Welcome back</h1>
<p>Here is what happened while you were away.</p>
</main>
</arc-app-shell>import { AppShell, TopBar } from '@arclux/arc-ui-react';
export function DashboardLayout({ children }: { children: React.ReactNode }) {
return (
<AppShell>
<TopBar slot="topbar" heading="Dashboard" />
<nav slot="sidebar" style={{ width: 200, padding: 16 }}>
<a href="/overview">Overview</a>
<a href="/analytics">Analytics</a>
<a href="/settings">Settings</a>
</nav>
<main>{children}</main>
</AppShell>
);
}<script setup>
import { AppShell, TopBar } from '@arclux/arc-ui-vue';
</script>
<template>
<AppShell>
<TopBar slot="topbar" heading="Dashboard" />
<nav slot="sidebar" style="width: 200px; padding: 16px;">
<a href="/overview">Overview</a>
<a href="/analytics">Analytics</a>
<a href="/settings">Settings</a>
</nav>
<main>
<slot />
</main>
</AppShell>
</template><script>
import { AppShell, TopBar } from '@arclux/arc-ui-svelte';
</script>
<AppShell>
<TopBar slot="topbar" heading="Dashboard" />
<nav slot="sidebar" style="width: 200px; padding: 16px;">
<a href="/overview">Overview</a>
<a href="/analytics">Analytics</a>
<a href="/settings">Settings</a>
</nav>
<main>
<slot />
</main>
</AppShell>import { Component } from '@angular/core';
import { AppShell, TopBar } from '@arclux/arc-ui-angular';
@Component({
imports: [AppShell, TopBar],
template: `
<arc-app-shell>
<arc-top-bar slot="topbar" heading="Dashboard"></arc-top-bar>
<nav slot="sidebar" style="width: 200px; padding: 16px;">
<a href="/overview">Overview</a>
<a href="/analytics">Analytics</a>
<a href="/settings">Settings</a>
</nav>
<main>
<ng-content />
</main>
</arc-app-shell>
`,
})
export class DashboardLayoutComponent {}import { AppShell, TopBar } from '@arclux/arc-ui-solid';
import type { ParentProps } from 'solid-js';
export function DashboardLayout(props: ParentProps) {
return (
<AppShell>
<TopBar slot="topbar" heading="Dashboard" />
<nav slot="sidebar" style={{ width: '200px', padding: '16px' }}>
<a href="/overview">Overview</a>
<a href="/analytics">Analytics</a>
<a href="/settings">Settings</a>
</nav>
<main>{props.children}</main>
</AppShell>
);
}import { AppShell, TopBar } from '@arclux/arc-ui-preact';
import type { ComponentChildren } from 'preact';
export function DashboardLayout({ children }: { children: ComponentChildren }) {
return (
<AppShell>
<TopBar slot="topbar" heading="Dashboard" />
<nav slot="sidebar" style={{ width: 200, padding: 16 }}>
<a href="/overview">Overview</a>
<a href="/analytics">Analytics</a>
<a href="/settings">Settings</a>
</nav>
<main>{children}</main>
</AppShell>
);
}<!-- Auto-generated by @arclux/prism — do not edit manually -->
<!-- arc-app-shell — requires app-shell.css + base.css (or arc-ui.css) -->
<div class="arc-app-shell">
<div class="shell">
<div class="shell__body">
<div class="shell__sidebar">
<!-- sidebar nav goes here -->
</div>
<div class="shell__main">
<div class="shell__content">
AppShell
</div>
<div class="shell__toc">
<!-- optional table-of-contents -->
</div>
</div>
</div>
</div>
</div><!-- Auto-generated by @arclux/prism — do not edit manually -->
<!-- arc-app-shell — self-contained, no external CSS needed -->
<style>
@media (max-width: 1280px) {
.arc-app-shell .shell__toc { display: none; }
}
@media (max-width: 768px) {
.arc-app-shell .shell__sidebar { display: none; }
}
@media (max-width: 768px) {
.arc-app-shell([sidebar-open]) .shell__sidebar { display: block; }
}
</style>
<div class="arc-app-shell" style="display: block; min-height: 100vh; background: rgb(3, 3, 7); color: rgb(232, 232, 236)">
<div class="shell" style="display: flex; flex-direction: column; min-height: 100vh">
<div style="display: flex; flex: 1; padding-top: 64px">
<div class="shell__sidebar" style="flex-shrink: 0">
<!-- sidebar nav goes here -->
</div>
<div style="flex: 1; min-width: 0; display: flex">
<div style="flex: 1; min-width: 0; padding: 40px 40px; max-width: 860px">
AppShell
</div>
<div class="shell__toc" style="flex-shrink: 0; width: 220px">
<!-- optional table-of-contents -->
</div>
</div>
</div>
</div>
</div>API
breakpointnumber- Viewport width in pixels at which the layout switches between mobile and desktop modes.
sidebarOpenbooleanfalse- Controls whether the sidebar is visible on mobile viewports (below 768 px). On desktop the sidebar is always shown regardless of this attribute. Toggle it from a hamburger button in your TopBar to give mobile users access to navigation.
embeddedbooleanfalse- Fills the container instead of the viewport. The shell takes the height you give it (
height: 100%of a bounded parent, or any length), its content area becomes the scroll context rather than the page, and the sidebar rail is stretched by the body rather than sized from the screen, since a sticky rail has nothing to stick against once the page is not what scrolls. Use it for a shell inside a card, a dashboard cell, a split pane, or a documentation preview; leave it off for the full-page layout, which is what the component is for.
Events
arc-sidebar-toggledetail:{ value: boolean }- Fired when the shell itself opens or closes the mobile sidebar: on a backdrop click, on Escape, on navigation, or when the viewport widens past the breakpoint and the drawer stops existing. Listened to by arc-top-bar so its hamburger stays in step, and by any wrapper binding
sidebarOpen. Not fired for a toggle the shell merely received, so the two cannot echo each other.
See also
- Page LayoutA CSS Grid page frame whose `layout` attribute picks a left sidebar, a right aside, a centered column or full width.
- SidebarA vertical list of navigation links in grouped sections that can collapse, with the current page highlighted.
- Top BarThe header bar across the top of an app, with the brand on the left and user controls on the right.
- FooterPage footer with slots for a logo, link columns, social icons and legal text.
- Auth ShellA page layout for sign-in, sign-up and password reset, with the form in a centered card or beside an aside panel.