Loading component…
Loading component…
This component has not been implemented locally yet.
To reuse this local React demo, copy all files from the Code tab into the same folder, then import AppShellInset from ./app-shell.
import { AppShell } from "@/components/ui/app-shell";
export function Layout({ children }: { children: React.ReactNode }) {
return (
<AppShell
active="New chat"
workspace="Acme"
user={{ name: "Alex Morgan" }}
onNavigate={(label) => router.push(routes[label])}
// The work area on the right, with tabs: it starts with a New tab – address field, Tools and Suggested;
// a suggestion with an artifact opens it in the tab, in the shared viewers
workArea={{ artifacts: files, newTab: { sources: suggested, onOpen: (id) => openTool(id) } }}
>
<div className="ui-as-page">{children}</div>
</AppShell>
);
}| Name | Type | Default | Description |
|---|---|---|---|
| children | ReactNode | The page shown next to the sidebar | |
| active | string | Label of the menu item or project that is open | |
| onNavigate | (label: string) => void | Called with the label of a menu item or project when it is clicked | |
| workspace | string | "Acme" | Workspace name; its first letter becomes the logo |
| user | { name: string; avatar?: string; email?: string } | { name: "Alex Morgan" } | Account at the bottom; without an avatar it shows initials. Its menu opens with picture, name and email, then language, appearance, integrations, settings, apps, changelog, help and log out |
| nav | ShellNavItem[] | New chat, Folders, Integrations | Menu items, each { label, icon } |
| projects | string[] | Project list under the menu | |
| chats | ShellChat[] | Chats in the sidebar – with it the projects become folders that open and close and hold the chats whose folder they are; the rest under Pinned and Chats. A ⋯ menu (rename, pin, unread, project, section, share, copy, new window, archive) and a pin on hover; drag to reorder or into a folder | |
| onOpenChat | (chat: ShellChat) => void | Called when a chat is clicked (default: onNavigate with its title) | |
| sidebarWidth | { default?: number; min?: number; max?: number } | { default: 272, min: 220, max: 380 } | Sidebar width in px – drag its edge between min and max, double-click the edge for the default |
| header | { title: ReactNode; actions?: ReactNode } \| false | A header across the whole app, like Claude's – sidebar toggle and search, the page's title (BarTitle) and actions, the work area's title; one line under it | |
| sideCards | boolean | true | The cards at the bottom of the sidebar – what's new and Getting started; false hides both |
| workArea | WorkAreaOptions \| WorkArea | The work area on the right, with tabs like Codex – resizable and collapsible like the sidebar. Pass the options, or the result of useWorkArea(options) when the page opens artifacts itself. Options: tabs (your own { id, title, label?, icon?, count?, content } and artifacts { artifact, from? }), defaultTabs (ids open at the start and whenever the work area opens again after its last tab closed – "new" adds a New tab; default: every tab, or one New tab), initialTabs (when the start differs), artifacts (content by file name), onOpenArtifact, onArtifactChange, newTab ({ tools, sources, onOpen } for a New tab's start options, or false for no + and no New tabs) | |
| panel | ReactNode | Plain content for the work area – it becomes its one tab, named by panelTitle; use workArea for more | |
| panelTitle | string | "Workspace" | Name of the work area – the label of its tablist and its open / close buttons, and the title of a plain panel's tab |
| panelHeading | ReactNode | What the tab of a plain panel shows instead of panelTitle, e.g. "Brief / Summer launch" | |
| defaultPanelOpen | boolean | true | Start with the work area folded away – its icon waits in the top right corner |
| panelWidth | { default?: number; min?: number; max?: number } | { default: 360, min: 280, max: 560 } | Width of the work area in px, like sidebarWidth. Up to a 1440px wide app these are the sizes; on wider screens the default and the max grow in proportion, so the work area keeps its share |
| layout | "inset" \| "flat" | "inset" | Inset: the page as a rounded panel on the gray page. Flat: edge to edge next to the sidebar, split by a hairline. Without it, data-shell="flat" on an ancestor (e.g. <html>) makes every App Shell flat |
| className | string | Extra class on the root | |
| EmptyState | { title; text; action?; tall?; bare? } | What a list or page shows when there's nothing in it: an icon tile, a title, one line on how to fill it and an optional button. Framed by default; bare without the frame when it's the page's only content | |
| Spinner | { size?: number; label?: string; className? } | One spinner for every screen – an arc on a faint ring in the text color (default 14px), for something that works right now. With label it's announced as a status; without it stays silent next to text that says what happens | |
| Skeleton, Loading | Skeleton { width?; height?; radius?; className? } · Loading { label?; className?; children } | The loading state while a page's data comes in: Skeleton is a gray bar or shape a soft sheen sweeps across; Loading wraps the skeletons of one area (role="status", aria-busy) and fades in after 150ms, so a fast load never flashes. Give the skeletons the size of the text and shapes they stand in for, inside the real grid or list class, so nothing jumps when the data lands | |
| useWorkArea(options) | → { open(name, from?), show(id), openNew(), artifact(name) } | The work area's state in your screen – which tabs are open, the one in front, and every change to an artifact, kept by file name while the screen lives (close a tab and open it again: your edits are still there). open brings an artifact's tab to the front and opens the work area if it's folded; from is the line under its name. Inside the page useShellWorkArea() returns the same | |
| ArtifactChips | { names: string[]; onOpen: (name) => void } | Artifacts as soft gray file chips with a glyph by type – e.g. a task's or a message's files | |
| WorkspacePanel tools | WorkspaceTool[] | Terminal, Browser, Notes | Rows under Tools, each { id, label, icon, shortcut? } |
| WorkspacePanel sources | WorkspaceSource[] | Rows under Suggested, each { id, title, source, mark?, artifact? } – in a New tab, one with an artifact opens it in that tab (source is the line under its name) | |
| WorkspacePanel onOpen | (id: string) => void | A tool or a suggestion was clicked |
Fills its container – give it the full viewport height in your app
Below 900px the work area becomes a drawer from the right, like the sidebar from the left – its tabs, toolbars and menus fit down to 320px
The work area never scrolls sideways: tabs first narrow (92–156px, names fading out), then the strip scrolls inside itself; a wide sheet scrolls inside itself
Dark mode built in: switches when an ancestor (usually <html>) has the class dark or data-theme="dark"; colors are CSS variables on .ui-as
Inset or flat for a whole app at once: data-shell="flat" on <html> – every screen built on App Shell follows