OfferLifetime Pro for $99

App Shell

A sidebar with your workspace, nav (with sub-pages) and projects, a top bar for the page's own header and your account, and a page that is the only thing that scrolls. It collapses to an icon rail with ⌘B, becomes a drawer under 900px of its own width, and ⌘K lists every page without a second list to maintain.

The decision inside it

Every page, three ways in

The sidebar, the rail's tooltips and ⌘K all read the same nav and sections, so a page added once is findable everywhere. A parent opens itself when one of its children is the current page, so the active row is never hidden in a closed group.

When to use it

Use App Shell for the frame around every screen of an app: workspace switcher, nav with sub-pages, project lists, a top bar for the page's header and the account menu, ⌘K search and ⌘B collapse. Use Sidebar on its own when you already have a layout and only need the navigation.

Installation

How you get it

Paste this into Claude Code, Cursor, Codex or any coding agent. It installs the file and uses it as it is, instead of writing a new one.

Use Layro's App Shell for this.
Install it: npx shadcn@latest add @layro/app-shell
(the @layro registry is set up in components.json, with LAYRO_KEY in .env.local)
Import it from @/components/ui/app-shell.
Do not rewrite or restyle it. Pass my data through its props
and keep its built-in states.

For the full brief with every prop and the mistakes assistants usually make, use Copy prompt above. Pro components install through the @layro registry with your CLI token: see the Namespaced tab.

Usage

app/(app)/layout.tsx
"use client";

import { usePathname, useRouter } from "next/navigation";
import * as React from "react";
import { FileText, Home, Inbox, Users } from "lucide-react";
import { AppShell } from "@/components/ui/app-shell";

export default function AppLayout({ children }: { children: React.ReactNode }) {
  const router = useRouter();
  const pathname = usePathname();
  return (
    <div className="h-dvh">
      <AppShell
        workspace={{ name: "Madgixs", meta: "Team plan" }}
        nav={[
          { label: "Overview", href: "/", icon: <Home /> },
          { label: "Inbox", href: "/inbox", icon: <Inbox />, badge: 3 },
          {
            label: "Documents",
            icon: <FileText />,
            children: [
              { label: "All documents", href: "/documents" },
              { label: "Drafts", href: "/documents/drafts" },
            ],
          },
          { label: "Members", href: "/members", icon: <Users /> },
        ]}
        sections={[{ title: "Projects", items: [{ label: "Fenwick Row lease", href: "/projects/fenwick" }] }]}
        user={{ name: "Michael Carter", email: "michael@madgixs.com" }}
        header={<span className="text-[13.5px] font-medium">Madgixs</span>}
        activeHref={pathname}
        onNavigate={(href) => router.push(href)}
      >
        {children}
      </AppShell>
    </div>
  );
}

API reference

“Copy prompt” above puts a full brief on your clipboard — install command, dependencies, props, and the mistakes an assistant usually makes with this component.

Props

Read from the component’s own TypeScript interface when the site is built, so this table cannot drift from the file you install.

PropTypeNotes
variant"inset" | "flat""inset" (default) floats the page as a card; "flat" runs it edge to edge.
workspacerequired{ name: string; logo?: string; icon?: React.ReactNode; meta?: string }The workspace you are in. Shown in the header, and as its mark in the rail.
workspacesWorkspace[]Other workspaces: turns the header into a Team Switcher.
workspaceIdstringId of the workspace you are in, when `workspaces` is passed.
onWorkspaceChange(id: string, workspace: Workspace) => void—
navrequiredAppShellNavItem[]The main nav, without a heading.
sectionsAppShellSection[]Headed groups under the nav: Projects, Favourites.
userrequiredProfileUserThe signed-in person, opened as a Profile Menu from the top bar.
profileOmit<ProfileMenuProps, "user" | "variant">Passed to the Profile Menu: plan, theme, sign out, accounts.
headerReact.ReactNodeThe page's own header in the top bar: a breadcrumb, a title, actions.
sidebarFooterReact.ReactNodePinned to the foot of the sidebar: usage, an upgrade card. Hidden in the rail.
activeHrefstringThe current page. Without it the shell tracks the last row chosen.
onNavigate(href: string) => voidCalled instead of following the link, for client-side routing.
commandsAppShellCommand[]Extra rows for ⌘K, under "Actions".
collapsedbooleanCollapsed to the icon rail. Controlled.
defaultCollapsedbooleanCollapsed on first render. Default false.
onCollapsedChange(collapsed: boolean) => void—
shortcutsbooleanListen for ⌘K and ⌘B. Default true; turn off when two shells share a page.
sidebarWidthnumberSidebar width in px. Default 248.
labelstringAccessible name for the nav. Default "Main".
childrenrequiredReact.ReactNode—

Dependencies

npm packages

clsxframer-motionlucide-reacttailwind-merge

Layro foundations, installed alongside it

layro-themecommandprofile-menusidebarteam-switchertooltipworkspace-mark

States

All of them are drawn by the component. None is left for you to design.

  • Inset
  • Flat
  • Collapsed to rail
  • Phone drawer
  • Command menu

Accessibility

  • Keyboard reachable throughout, in visual order
  • Focus trapped in overlays, Escape closes them
  • Focus returns to whatever opened it
  • Live regions announce what changed, not that something did
  • Honours prefers-reduced-motion

Responsive behavior

  • Sizes to its container, not the viewport
  • Usable from 320px up
  • Pointer-based interaction, so trackpad and touch both work
  • No hover-only affordances

Used in screensAll screens

Lifetime access

Every component, and everything we ship next.

  • All 232 components, source included
  • Every template, and everything released after you buy
  • shadcn CLI or download — React 18/19, Tailwind v4
  • One payment. No subscription.