App Shell
app-shellThe frame of an app: a sidebar of sections and nav items, a header bar, a page header and a scrolling content column. On narrow screens the sidebar becomes a sheet in a native modal dialog.
"use client";
import {
Bell,
Bot,
ChartColumn,
Inbox,
LayoutGrid,
Plus,
Search,
Settings,
Users,
} from "lucide-react";
import { useState } from "react";
import type { MouseEvent } from "react";
import { Breadcrumb } from "@/components/forme/breadcrumb/breadcrumb";
import { Button } from "@/components/forme/button/button";
import {
Popover,
PopoverContent,
PopoverTitle,
PopoverTrigger,
} from "@/components/forme/popover/popover";
import {
AppContent,
AppHeader,
AppNavItem,
AppPageHeader,
AppShell,
AppSidebarFooter,
AppSidebarHeader,
AppSidebarNav,
AppSidebarSection,
} from "@/components/forme/blocks/app-shell/app-shell";
const pages = [
{ id: "overview", label: "Overview", icon: <LayoutGrid /> },
{ id: "inbox", label: "Inbox", icon: <Inbox />, badge: 4 },
{ id: "analytics", label: "Analytics", icon: <ChartColumn /> },
{ id: "customers", label: "Customers", icon: <Users /> },
{ id: "agents", label: "Agents", icon: <Bot /> },
];
const notifications = [
{ who: "Ada Kim", what: "invited you to Billing", when: "2m", unread: true },
{ who: "Forge agent", what: "finished the proration change", when: "14m", unread: true },
{ who: "Lin Park", what: "commented on Invoice #1042", when: "1h", unread: false },
];
export function AppShellDemo() {
const [page, setPage] = useState("overview");
const current = pages.find((entry) => entry.id === page) ?? pages[0]!;
const unread = notifications.filter((item) => item.unread).length;
// The demo has no router: links switch the page in place.
const go = (id: string) => (event: MouseEvent) => {
event.preventDefault();
setPage(id);
};
return (
<div className="w-full overflow-hidden rounded-xl border border-border">
<AppShell
className="h-[40rem]"
sidebar={
<>
<AppSidebarHeader>
<span className="grid size-7 place-items-center rounded-md bg-mark text-caption-1-semibold text-primary-foreground">
A
</span>
<span className="text-body-medium text-foreground">Acme Inc</span>
</AppSidebarHeader>
<AppSidebarNav>
<AppSidebarSection title="Workspace">
{pages.map((entry) => (
<AppNavItem
key={entry.id}
href={`#${entry.id}`}
icon={entry.icon}
badge={entry.badge}
active={entry.id === page}
onClick={go(entry.id)}
>
{entry.label}
</AppNavItem>
))}
</AppSidebarSection>
<AppSidebarSection title="General">
<AppNavItem
href="#settings"
icon={<Settings />}
active={page === "settings"}
onClick={go("settings")}
>
Settings
</AppNavItem>
</AppSidebarSection>
</AppSidebarNav>
<AppSidebarFooter>
<div className="flex items-center gap-2.5 px-1">
<span className="grid size-8 place-items-center rounded-full bg-brand-subtle text-caption-1-medium text-brand-strong">
AK
</span>
<span className="min-w-0">
<span className="block truncate text-body-2-medium text-foreground">Ada Kim</span>
<span className="block truncate text-caption-1-regular text-muted-foreground">
ada@acme.com
</span>
</span>
</div>
</AppSidebarFooter>
</>
}
>
<AppHeader>
<Breadcrumb
className="min-w-0"
items={[{ label: "Acme", href: "#" }, { label: current.label }]}
/>
<div className="ms-auto flex items-center gap-1">
<Button
variant="ghost"
size="small"
iconOnly
leadingIcon={Search}
aria-label="Search"
/>
<Popover>
<PopoverTrigger
aria-label={`Notifications, ${unread} unread`}
className="relative grid size-8 cursor-pointer place-items-center rounded-md text-muted-foreground hover:bg-accent hover:text-foreground data-[popup-open]:bg-accent"
>
<Bell aria-hidden className="size-4" />
<span
aria-hidden
className="absolute end-1.5 top-1.5 size-2 rounded-full bg-destructive ring-2 ring-background"
/>
</PopoverTrigger>
<PopoverContent side="bottom" align="end" className="w-80 p-1.5">
<PopoverTitle className="px-2.5 pt-1.5 pb-2 text-caption-1-medium text-muted-foreground">
Notifications
</PopoverTitle>
<ul className="flex flex-col">
{notifications.map((item) => (
<li key={item.what} className="flex items-start gap-2.5 rounded-md px-2.5 py-2">
<span
aria-hidden
className={
item.unread
? "mt-1.5 size-1.5 shrink-0 rounded-full bg-primary"
: "mt-1.5 size-1.5 shrink-0"
}
/>
<span className="min-w-0 flex-1 text-body-2-regular text-muted-foreground">
<span className="text-foreground">{item.who}</span> {item.what}
{item.unread ? <span className="sr-only"> (unread)</span> : null}
</span>
<span className="shrink-0 text-caption-1-regular text-text-tertiary tnum">
{item.when}
</span>
</li>
))}
</ul>
</PopoverContent>
</Popover>
</div>
</AppHeader>
<AppContent>
<AppPageHeader
title={current.label}
description="Updated 4 minutes ago"
actions={
<Button size="small" leadingIcon={Plus}>
New report
</Button>
}
/>
<div className="grid gap-4 sm:grid-cols-3">
{["Revenue", "Active users", "Churn"].map((label, index) => (
<div key={label} className="rounded-xl border border-border bg-card lit edge p-5">
<p className="text-body-2-regular text-muted-foreground">{label}</p>
<p className="mt-1 text-headline-semibold text-foreground tnum">
{["$48,210", "2,914", "1.8%"][index]}
</p>
</div>
))}
</div>
<div className="h-72 rounded-xl border border-dashed border-border" />
</AppContent>
</AppShell>
</div>
);
}Install
Adds the component, its registry dependencies, and the token stylesheet you import once.
API reference
Read from the source, so it is the API of the file you install. A prop marked * is required.
AppSidebarSection
A titled run of nav items.
| Prop | Type | Default | Description |
|---|---|---|---|
title | ReactNode | — |
Also takes every prop of <div> attributes.
AppNavItem
| Prop | Type | Default | Description |
|---|---|---|---|
active | boolean | — | The page this item is for is the one on screen. |
icon | ReactNode | — | |
badge | ReactNode | — | A count on the right: unread, open, new. |
as | ElementType | "a" | The link component, e.g. Next's Link. A plain <a> by default. |
Also takes every prop of <a> attributes.
AppPageHeader
| Prop | Type | Default | Description |
|---|---|---|---|
title* | ReactNode | — | |
description | ReactNode | — | |
actions | ReactNode | — | Buttons on the right, wrapping under the title on narrow screens. |
Also takes every prop of <div> attributes.
The other parts
AppSidebarHeaderTakes<div>attributesAppSidebarNavTakes<nav>attributesAppSidebarFooterTakes<div>attributesAppHeaderTakes<header>attributesAppContentTakes<main>attributes
Related


Infinite Masonry
An endless photo feed in balanced columns. Tiles reserve their space from the image size, so nothing shifts as pages arrive; the next page loads as the shortest column nears view; and it is an ARIA feed with Page Down between items. No virtualiser, no dependencies.
application

Transcript Player
A recording and its transcript as one surface: the line and word being spoken are marked as it plays, and a click on any line or word seeks there. Takes WhisperX output as it comes.
application
ProKanban Board
A project board with pointer drag and drop, a full keyboard path, status or assignee swimlanes, live WIP limits, inline card capture, and a detail drawer for descriptions and checklists.
application