Skip to content

App Shell

The frame of a signed-in app: a sidebar with a workspace switcher, nav, pinned items and a usage slot that folds to an icon rail, and a topbar with a breadcrumb, search, notifications and the account menu. On phones the sidebar is a sheet.

On this page
Used for
  • Signed-in app frame
  • Agent dashboard layout
  • Settings area chrome
  • Console with a sticky topbar
  • Embedded preview frame

Examples

Icon rail

Installation

npx knowns-ui@latest add app-shell
For Claude Code, Cursor or Codex: installs it and wires the props to your own data.

Props

nav / active / onSelect / linkAs
SidebarNode[] / string / (node) => void / Component
The main tree (see Sidebar): icons, counts, badges, nested branches. The active row is marked and its branch opens.
workspaces / workspace / onWorkspaceChange / onCreateWorkspace
SidebarWorkspace[] / string / …
The switcher at the top; leave out for one workspace.
groups
{ id, label, items, collapsible? }[]
Default[]
Pinned items, favourites: labelled, foldable groups under the nav.
sidebarFooter
ReactNode
The bottom of the sidebar: a usage meter or an upgrade card. Hidden in the rail.
sidebarWidth
number
Default256
Expanded sidebar width in px.
sidebarClassName
string
Extra classes on the sidebar panel, e.g. [&_.h-8]:h-7 to make the nav rows 28px.
breadcrumb
BreadcrumbItem[]
Where you are. Long trails fold their middle into a menu.
onHome
() => void
Go to the app's home view: the first crumb (the workspace) becomes the home control, then the page scrolls to the top.
search
{ onOpen, label? }
A search field with a ⌘K hint from 768px, an icon below. Open your Command Menu here.
notifications / actions / user
ReactNode
Topbar slots, right to left: your UserMenu last.
storageKey / defaultCollapsed / hotkey / mobileBelow
string / boolean / boolean / number
Default - / false / true / 768
State: the remembered rail, ⌘B or Ctrl+B, and the width below which the sidebar is a sheet.
layout
"page" | "fill"
Default"page"
page: the window scrolls, the sidebar and topbar stick. fill: the shell fills its parent and the main column scrolls.
embedded
boolean
Defaultfalse
Render the main column as a div and the sidebar without an aside landmark, for a shell shown inside another page (one main per page).
labelPrefix
string
Prefixes the shell's navigation and breadcrumb labels so two shells on one page have unique names.

Built from the Sidebar block, so the keyboard is the same: ⌘B or Ctrl+B toggles the rail, the nav is one tab stop with arrow keys inside, and the rail shows each name as a tooltip. On phones the topbar's toggle opens the sidebar as a modal sheet that returns focus when it closes.

What it handles

  1. 01Wraps your page in a sidebar and a sticky 56px topbar, from props alone: `nav`, `groups`, `workspaces`, `breadcrumb`, `search`, `notifications`, `actions` and `user`.
  2. 02Marks the current row with `active` and passes every picked row to `onSelect`, with `linkAs` to swap the row link for your router's link.
  3. 03Adds labelled pinned groups under the main nav, each its own SidebarNav that can fold, with its open state saved under `storageKey`.
  4. 04Keeps the sidebar in a rail the user chose, with Cmd or Ctrl+B and a footer slot for a usage meter that hides itself in the rail.
  5. 05Scrolls the window with layout="page", or fills its parent and scrolls only the main column with layout="fill" for a preview frame.
  6. 06Drops its own main and complementary landmarks with `embedded`, and prefixes its names with `labelPrefix`, so several shells on one page stay unique.

States

First render
Nothing. The shell paints with its remembered rail state
none
Collapse the sidebar
The sidebar width switches at once and its labels fade out
120ms, ease out
Fold a pinned group
The group's rows grow or shrink and fade
180ms, ease out
Search button
Opens your handler with no motion of its own
none
Reduced motion
Labels no longer fade and groups fold at once
0ms

Works with

When to use

When to use

  • The frame of a signed-in app: sidebar with a workspace switcher and nav, topbar with breadcrumb, search, notifications and the account menu.
  • Dashboards and admin tools where the navigation stays put and only the page changes.

When not to use

  • Only the navigation column, inside your own layout: use Sidebar.
  • Marketing pages and docs with a top bar: use Site Header.

Using with AI

Use Copy page for AI above to give your assistant this page, Copy prompt under the install command to have it installed and wired to your data, or connect the Knowns UI MCP server and just ask:

  • Add the Knowns UI App Shell to my app and wire it to my own data.
  • I need the frame of a signed-in app: sidebar with a workspace switcher and nav, topbar with breadcrumb, search, notifications and the account menu. Set that up with the Knowns UI App Shell.
  • Which App Shell props do I need for a minimal setup? Show me a short example.

With the server connected, your assistant calls get_component({ name: "app-shell" }) and search_docs({ query: "app shell" }).

Need help?

Stuck on App Shell, or found something off? We read every message.