# AppShell

> App layout with a sidebar and main area: desktop collapse to an icon rail, a mobile drawer, and a mobile top bar.

Status: stable. Category: Patterns.

```ts
import { AppShell } from '@glyphui/ui'
```

Exports: `AppShell`, `useAppShell`, `appShellStyles`.

## Notes

- The mobile drawer traps focus and closes when a SidebarItem is chosen.
- useAppShell exposes collapsed and mobileOpen state to your own components.

## AppShell props

| Prop | Type | Default | Description |
|---|---|---|---|
| `sidebar` (required) | `ReactNode` |  | A `<Sidebar>`. Shown fixed on desktop and in a drawer on mobile. |
| `collapsed` | `boolean` |  |  |
| `defaultCollapsed` | `boolean` |  |  |
| `layout` | `"page" \| "embedded"` |  |  |
| `mobileBrand` | `ReactNode` |  | Shown next to the menu button in the mobile top bar. |
| `onCollapsedChange` | `((collapsed: boolean) => void)` |  |  |

## Example: Embedded layout

layout="page" fills the viewport; "embedded" fills its parent.

```tsx
import {
  AppShell,
  PageHeader,
  Sidebar,
  SidebarContent,
  SidebarHeader,
  SidebarItem,
  SidebarTrigger,
  Text,
} from '@glyphui/ui'
import { CircleDot, Inbox, SquareKanban } from 'lucide-react'

export default function Example() {
  return (
    <div className="h-96 overflow-hidden rounded-lg border border-border">
      <AppShell
        layout="embedded"
        mobileBrand={<span className="text-small font-semibold">Acme</span>}
        sidebar={
          <Sidebar>
            <SidebarHeader>
              <span className="truncate text-small font-semibold">Acme Inc.</span>
            </SidebarHeader>
            <SidebarContent>
              <SidebarItem icon={<Inbox />} badge={3}>
                Inbox
              </SidebarItem>
              <SidebarItem icon={<CircleDot />} active>
                Issues
              </SidebarItem>
              <SidebarItem icon={<SquareKanban />}>Projects</SidebarItem>
            </SidebarContent>
          </Sidebar>
        }
      >
        <div className="grid gap-4 p-5">
          <div className="hidden md:block">
            <SidebarTrigger />
          </div>
          <PageHeader title="Issues" description="12 open, 3 due this week." />
          <Text tone="muted">Your page content goes here.</Text>
        </div>
      </AppShell>
    </div>
  )
}
```

Live page: https://glyphui.xyz/components/app-shell
