Skip to content

App shell

An app's frame: a full-height sidebar you can resize in steps beside a page box that scrolls on its own, a ⌘K command palette, and a menu sheet on phones.

LayoutNavigationSidebarCommand
npx shadcn@latest add @silicon-ui/app-shell

Installation

With the shadcn CLI

npx shadcn@latest add @silicon-ui/app-shell

Manually

  1. Install the dependencies

    npm install lucide-react
  2. Copy these files into your project

    • components/silicon-ui/app-shell/app-shell.tsx
    • components/silicon-ui/app-shell/app-shell.module.css

    Shared with other components. Skip any you already have.

    • components/silicon-ui/lib/sidebar-rail.tsx
  3. Add the foundation, once per app, for the design and motion tokens

    npx shadcn@latest add @silicon-ui/silicon-foundation

Usage

usage.tsx
import { AppShell } from "@/components/silicon-ui/app-shell/app-shell";

API reference

PropTypeDefault
brand*

The product's wordmark, usually a link home. At the sidebar's head from 900px, in the top bar under 900px.

ReactNode—
nav*

The sidebar's destinations, usually a NavList (size "md").

ReactNode—
children*

The page. It is drawn in the page box, the only thing that scrolls from 900px.

ReactNode—
search

Under the brand, above the navigation: a search field, for an app whose content people search (the Apps store's apps): usually a SearchField with `hideLabel` in a GET form, so it works without script. Search is not the command palette: with `commands` too, the field takes this place and ⌘K still opens the palette. Without it, `commands` draws the shell's own Search row here, which opens the palette.

ReactNode—
account

At the sidebar's foot: the signed-in account (a UserMenu or a profile switcher, a link to settings) or a sign-in button. Pass a function to draw it per place: a menu that opens upward beside the page, and its rows listed in place in the phone menu, so a phone never opens a second sheet over the first.

ReactNode | ((place: AppShellPlace) => ReactNode)—
links

Under the account, over a hairline: links to other sites, usually soft `xs` ButtonLinks.

ReactNode—
onNavigate

Called when a link in the brand, search, nav, account or links is followed with a plain click, after the phone menu starts to close. Call `event.preventDefault()` to run your own guards or transitions instead of the browser's navigation. Modified clicks (a new tab) don't call it.

(navigation: AppShellNavigation) => void—
steps

The sidebar's widths in px, narrowest first. With more than one, a handle on the page box's edge steps between them (drag, arrow keys, Home and End; a double-click goes back to `defaultStep`).

number[]DEFAULT_STEPS
defaultStep

Index into `steps` the sidebar starts at. Defaults to the middle step.

number—
storageKey

Remembers the chosen width in this browser's localStorage under this key (and whether the rail is on, under `{storageKey}:rail`). Without it the width resets on reload.

string—
rail

Lets the sidebar fold into a rail: its icons alone, the words in a tip beside each. Dragging the handle narrower than the first step or ⌘B (Ctrl B elsewhere) folds it; the same widen it back to the last width. In the rail NavList rows are icons (a row without one is left out), a section that can't be icons (one that opens and closes, holds sections, or has rows without icons) is its icon that opens it in a flyout (left out when it has no icon), AccountMenu is the photo, `search` is a button that widens the sidebar and goes to the field, and `links` are hidden. Phones always get the whole sidebar.

booleanfalse
defaultRail

Starts in the rail (until the person changes it, when `storageKey` remembers their choice).

booleanfalse
brandMark

The brand's mark alone, for the rail's head: a square logo, usually the same link home. Without it the rail's head shows the start of `brand`.

ReactNode—
sidebarLabel

Names the sidebar for screen readers.

string"Sidebar"
menuLabel

The phone menu's title and the menu button's name.

string"Menu"
linksLabel

Names the `links` navigation for screen readers.

string"Other sites"
skipLabel

The skip link's words; it moves focus to the page box.

string"Skip to content"
mainId

The page box's id, the skip link's target.

string"main"
commands

The command palette's commands. With any, ⌘K (Ctrl K elsewhere) opens and closes the palette, in a headerless dialog near the top of the window, and `useAppShell().openCommands()` opens it from a slot.

CommandItem[]—
onCommand

Called with the chosen command, once the palette has started to close (so focus is back before the command moves it).

(item: CommandItem) => void—
commandsOpen

Whether the palette is open, to control it (with `onCommandsOpenChange`).

boolean—
onCommandsOpenChange

Called when the palette opens or closes: ⌘K, the Search button, Escape, or a choice.

(open: boolean) => void—
commandsLabel

The palette's name for screen readers, and the Search button's.

string"Search pages and actions"
commandsPlaceholder

The palette's field placeholder.

string"Search pages and actions"
searchLabel

The shell's own Search button's words.

string"Search"
className

Placement only, on the shell's root.

string—

Dependencies

npm
lucide-react
Registry
silicon-motion-tokensbottom-sheetbuttoncommand-palettedialog