{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "app-shell",
  "title": "App shell",
  "author": "Tori Bryan",
  "description": "A workspace app's frame: a header with Command menu on Cmd+K, pages for home, projects and an inbox, and Floating nav to move between them.",
  "dependencies": [
    "lucide-react"
  ],
  "registryDependencies": [
    "https://fibo.toribryan.com/r/avatar.json",
    "https://fibo.toribryan.com/r/command-menu.json",
    "https://fibo.toribryan.com/r/floating-nav.json",
    "utils",
    "https://fibo.toribryan.com/r/badge.json",
    "https://fibo.toribryan.com/r/button.json",
    "https://fibo.toribryan.com/r/empty-state.json",
    "https://fibo.toribryan.com/r/kbd.json",
    "https://fibo.toribryan.com/r/table.json"
  ],
  "files": [
    {
      "path": "registry/blocks/app-shell/app-shell.tsx",
      "content": "\"use client\"\n\nimport * as React from \"react\"\nimport {\n  CheckCheckIcon,\n  FolderIcon,\n  FolderOpenIcon,\n  HouseIcon,\n  InboxIcon,\n  PlusIcon,\n} from \"lucide-react\"\n\nimport { Avatar, AvatarFallback } from \"@/components/ui/avatar\"\nimport {\n  CommandMenu,\n  type CommandMenuGroup,\n} from \"@/components/ui/command-menu\"\nimport { FloatingNav } from \"@/components/ui/floating-nav\"\nimport { cn } from \"@/lib/utils\"\n\nimport {\n  messages as initialMessages,\n  projects as initialProjects,\n  user,\n  workspace,\n  type Page,\n  type Project,\n} from \"./data\"\nimport { HomePage, InboxPage, ProjectsPage } from \"./pages\"\n\nconst NAV = [\n  { value: \"home\", label: \"Home\", icon: <HouseIcon /> },\n  { value: \"projects\", label: \"Projects\", icon: <FolderIcon /> },\n  { value: \"inbox\", label: \"Inbox\", icon: <InboxIcon /> },\n] satisfies { value: Page; label: string; icon: React.ReactNode }[]\n\ntype AppShellProps = Omit<React.ComponentProps<\"div\">, \"children\"> & {\n  /** Where Command menu portals to. Defaults to the body. */\n  container?: HTMLElement | null\n}\n\n/**\n * A workspace app's frame: a header with Command menu, the current page, and\n * Floating nav to move between pages. Every command changes real state here,\n * so wiring it to your data means replacing the setters below.\n */\nfunction AppShell({ container, className, ...props }: AppShellProps) {\n  const [page, setPage] = React.useState<Page>(\"home\")\n  const [projects, setProjects] = React.useState(initialProjects)\n  const [messages, setMessages] = React.useState(initialMessages)\n  const [highlighted, setHighlighted] = React.useState<string>()\n\n  const openProject = (id: string) => {\n    setHighlighted(id)\n    setPage(\"projects\")\n  }\n\n  const createProject = () => {\n    const project: Project = {\n      id: `untitled-${projects.length + 1}`,\n      name: \"Untitled project\",\n      status: \"active\",\n      owner: { name: user.name, initials: user.initials },\n      updated: \"Just now\",\n    }\n    setProjects((current) => [project, ...current])\n    openProject(project.id)\n  }\n\n  const groups: CommandMenuGroup[] = [\n    {\n      label: \"Go to\",\n      items: NAV.map((item) => ({\n        value: `go-${item.value}`,\n        label: item.label,\n        icon: item.icon,\n        onSelect: () => setPage(item.value),\n      })),\n    },\n    {\n      label: \"Projects\",\n      items: [\n        {\n          value: \"new-project\",\n          label: \"New project\",\n          icon: <PlusIcon />,\n          keywords: [\"create\", \"add\"],\n          onSelect: createProject,\n        },\n        {\n          value: \"open-project\",\n          label: \"Open project\",\n          icon: <FolderOpenIcon />,\n          placeholder: \"Search projects…\",\n          items: projects.map((project) => ({\n            value: `open-${project.id}`,\n            label: project.name,\n            keywords: [project.owner.name],\n            onSelect: () => openProject(project.id),\n          })),\n        },\n      ],\n    },\n    {\n      label: \"Inbox\",\n      items: [\n        {\n          value: \"mark-all-read\",\n          label: \"Mark all as read\",\n          icon: <CheckCheckIcon />,\n          disabled: messages.length === 0,\n          onSelect: () => {\n            setMessages([])\n            setPage(\"inbox\")\n          },\n        },\n      ],\n    },\n  ]\n\n  return (\n    <div\n      data-slot=\"app-shell\"\n      className={cn(\n        \"@container/app-shell flex min-h-svh flex-col bg-background text-foreground\",\n        className\n      )}\n      {...props}\n    >\n      <header className=\"sticky top-0 z-10 flex h-14 shrink-0 items-center gap-3 border-b border-border bg-background px-4 @2xl/app-shell:px-8\">\n        <span className=\"flex min-w-0 items-center gap-2 text-sm font-semibold\">\n          <span\n            aria-hidden=\"true\"\n            className=\"flex size-7 shrink-0 items-center justify-center rounded-md bg-primary text-xs text-primary-foreground\"\n          >\n            {workspace.initials}\n          </span>\n          {/* Below md the search needs the room; the name stays for screen readers. */}\n          <span className=\"sr-only truncate @md/app-shell:not-sr-only\">\n            {workspace.name}\n          </span>\n        </span>\n        <div className=\"ml-auto flex items-center gap-3\">\n          <CommandMenu\n            groups={groups}\n            container={container}\n            placeholder=\"Search or run a command…\"\n          />\n          <Avatar size=\"sm\">\n            <AvatarFallback>{user.initials}</AvatarFallback>\n          </Avatar>\n        </div>\n      </header>\n\n      <main className=\"mx-auto flex w-full max-w-5xl flex-1 flex-col px-4 pt-8 pb-28 @2xl/app-shell:px-8\">\n        {page === \"home\" ? (\n          <HomePage\n            firstName={user.firstName}\n            projects={projects}\n            onOpenProject={openProject}\n          />\n        ) : page === \"projects\" ? (\n          <ProjectsPage\n            projects={projects}\n            highlighted={highlighted}\n            onCreate={createProject}\n          />\n        ) : (\n          <InboxPage\n            messages={messages}\n            onMarkAllRead={() => setMessages([])}\n          />\n        )}\n      </main>\n\n      {/* Sticky rather than fixed, so the nav stays inside the shell wherever\n          it's mounted, and the main padding keeps the last row clear of it. */}\n      <div className=\"pointer-events-none sticky bottom-4 flex justify-center px-4\">\n        <FloatingNav\n          items={NAV}\n          value={page}\n          onValueChange={(value) => setPage(value as Page)}\n          position=\"static\"\n          aria-label=\"Pages\"\n        />\n      </div>\n    </div>\n  )\n}\n\nexport { AppShell }\nexport type { AppShellProps }\n",
      "type": "registry:component",
      "target": "components/blocks/app-shell/app-shell.tsx"
    },
    {
      "path": "registry/blocks/app-shell/data.ts",
      "content": "// Placeholder content for the App shell block. Swap these for your own data;\n// the types are what the pages read.\n\ntype Page = \"home\" | \"projects\" | \"inbox\"\n\ntype ProjectStatus = \"active\" | \"review\" | \"paused\"\n\ntype Project = {\n  id: string\n  name: string\n  status: ProjectStatus\n  owner: { name: string; initials: string }\n  updated: string\n}\n\ntype Message = {\n  id: string\n  from: { name: string; initials: string }\n  subject: string\n  received: string\n}\n\nconst workspace = { name: \"Northwind\", initials: \"N\" }\n\nconst user = { name: \"Ada Lovelace\", firstName: \"Ada\", initials: \"AL\" }\n\nconst projects: Project[] = [\n  {\n    id: \"atlas\",\n    name: \"Atlas redesign\",\n    status: \"active\",\n    owner: { name: \"Grace Hopper\", initials: \"GH\" },\n    updated: \"2 hours ago\",\n  },\n  {\n    id: \"beacon\",\n    name: \"Beacon onboarding\",\n    status: \"review\",\n    owner: { name: \"Ada Lovelace\", initials: \"AL\" },\n    updated: \"Yesterday\",\n  },\n  {\n    id: \"cinder\",\n    name: \"Cinder billing\",\n    status: \"paused\",\n    owner: { name: \"Alan Turing\", initials: \"AT\" },\n    updated: \"Last week\",\n  },\n]\n\nconst messages: Message[] = [\n  {\n    id: \"m1\",\n    from: { name: \"Grace Hopper\", initials: \"GH\" },\n    subject: \"Atlas: final nav spec is ready for review\",\n    received: \"9:41\",\n  },\n  {\n    id: \"m2\",\n    from: { name: \"Alan Turing\", initials: \"AT\" },\n    subject: \"Cinder is paused until the pricing call\",\n    received: \"Yesterday\",\n  },\n  {\n    id: \"m3\",\n    from: { name: \"Katherine Johnson\", initials: \"KJ\" },\n    subject: \"Beacon copy notes\",\n    received: \"Monday\",\n  },\n]\n\nexport { messages, projects, user, workspace }\nexport type { Message, Page, Project, ProjectStatus }\n",
      "type": "registry:component",
      "target": "components/blocks/app-shell/data.ts"
    },
    {
      "path": "registry/blocks/app-shell/pages.tsx",
      "content": "import * as React from \"react\"\nimport {\n  ArrowRightIcon,\n  CheckCheckIcon,\n  InboxIcon,\n  PlusIcon,\n} from \"lucide-react\"\n\nimport { Avatar, AvatarFallback } from \"@/components/ui/avatar\"\nimport { Badge } from \"@/components/ui/badge\"\nimport { Button } from \"@/components/ui/button\"\nimport {\n  EmptyState,\n  EmptyStateDescription,\n  EmptyStateMedia,\n  EmptyStateTitle,\n} from \"@/components/ui/empty-state\"\nimport { Kbd, KbdGroup } from \"@/components/ui/kbd\"\nimport {\n  Table,\n  TableBody,\n  TableCell,\n  TableHead,\n  TableHeader,\n  TableRow,\n} from \"@/components/ui/table\"\n\nimport type { Message, Project, ProjectStatus } from \"./data\"\n\nconst STATUS: Record<\n  ProjectStatus,\n  { label: string; variant: \"success\" | \"info\" | \"secondary\" }\n> = {\n  active: { label: \"Active\", variant: \"success\" },\n  review: { label: \"In review\", variant: \"info\" },\n  paused: { label: \"Paused\", variant: \"secondary\" },\n}\n\nconst noSubscription = () => () => {}\n\n// Matches the key Command menu listens for: Cmd on Apple devices, Ctrl\n// elsewhere. The server snapshot keeps the first render hydration-safe.\nfunction useIsMac() {\n  return React.useSyncExternalStore(\n    noSubscription,\n    () => /mac|iphone|ipad/i.test(navigator.platform || navigator.userAgent),\n    () => false\n  )\n}\n\nfunction PageHeader({\n  title,\n  description,\n  action,\n}: {\n  title: string\n  description: string\n  action?: React.ReactNode\n}) {\n  return (\n    <div className=\"flex flex-col gap-4 @lg/app-shell:flex-row @lg/app-shell:items-end\">\n      <div className=\"flex min-w-0 flex-1 flex-col gap-1\">\n        <h1 className=\"m-0 text-2xl font-semibold tracking-tight text-foreground\">\n          {title}\n        </h1>\n        <p className=\"m-0 text-sm text-muted-foreground\">{description}</p>\n      </div>\n      {action}\n    </div>\n  )\n}\n\nfunction HomePage({\n  firstName,\n  projects,\n  onOpenProject,\n}: {\n  firstName: string\n  projects: Project[]\n  onOpenProject: (id: string) => void\n}) {\n  const mac = useIsMac()\n  return (\n    <div className=\"flex flex-col gap-8\">\n      <PageHeader\n        title={`Welcome back, ${firstName}`}\n        description=\"Pick up where you left off.\"\n      />\n      <section\n        aria-labelledby=\"app-shell-recent\"\n        className=\"flex flex-col gap-3\"\n      >\n        <h2\n          id=\"app-shell-recent\"\n          className=\"m-0 text-sm font-medium text-muted-foreground\"\n        >\n          Jump back in\n        </h2>\n        <div className=\"grid gap-3 @lg/app-shell:grid-cols-3\">\n          {projects.slice(0, 3).map((project) => (\n            <button\n              key={project.id}\n              type=\"button\"\n              onClick={() => onOpenProject(project.id)}\n              className=\"group flex flex-col gap-3 rounded-xl border border-border bg-card p-4 text-left transition-colors hover:border-ring focus-visible:ring-[3px] focus-visible:ring-ring-subtle focus-visible:outline-none\"\n            >\n              <span className=\"flex items-center gap-2\">\n                <span className=\"min-w-0 flex-1 truncate text-sm font-medium text-card-foreground\">\n                  {project.name}\n                </span>\n                <ArrowRightIcon\n                  aria-hidden=\"true\"\n                  className=\"size-4 text-muted-foreground transition-transform group-hover:translate-x-0.5\"\n                />\n              </span>\n              <span className=\"text-xs text-muted-foreground\">\n                Updated {project.updated.toLowerCase()}\n              </span>\n            </button>\n          ))}\n        </div>\n      </section>\n      <p className=\"m-0 flex flex-wrap items-center gap-1.5 text-sm text-muted-foreground\">\n        Press\n        <KbdGroup>\n          <Kbd>{mac ? \"⌘\" : \"Ctrl\"}</Kbd>\n          <Kbd>K</Kbd>\n        </KbdGroup>\n        to search, open a project or create one.\n      </p>\n    </div>\n  )\n}\n\nfunction ProjectsPage({\n  projects,\n  highlighted,\n  onCreate,\n}: {\n  projects: Project[]\n  /** The project opened last, marked so the eye lands on it. */\n  highlighted?: string\n  onCreate: () => void\n}) {\n  return (\n    <div className=\"flex flex-col gap-6\">\n      <PageHeader\n        title=\"Projects\"\n        description={`${projects.length} projects in this workspace.`}\n        action={\n          <Button onClick={onCreate}>\n            <PlusIcon data-icon=\"inline-start\" />\n            New project\n          </Button>\n        }\n      />\n      <div className=\"overflow-hidden rounded-xl border border-border\">\n        <Table>\n          <TableHeader>\n            <TableRow>\n              <TableHead>Name</TableHead>\n              <TableHead>Status</TableHead>\n              <TableHead className=\"hidden @xl/app-shell:table-cell\">\n                Owner\n              </TableHead>\n              <TableHead className=\"hidden text-right @xl/app-shell:table-cell\">\n                Updated\n              </TableHead>\n            </TableRow>\n          </TableHeader>\n          <TableBody>\n            {projects.map((project) => (\n              <TableRow\n                key={project.id}\n                data-state={project.id === highlighted ? \"selected\" : undefined}\n              >\n                <TableCell className=\"font-medium\">{project.name}</TableCell>\n                <TableCell>\n                  <Badge variant={STATUS[project.status].variant}>\n                    {STATUS[project.status].label}\n                  </Badge>\n                </TableCell>\n                <TableCell className=\"hidden @xl/app-shell:table-cell\">\n                  <span className=\"flex items-center gap-2\">\n                    <Avatar size=\"sm\">\n                      <AvatarFallback>{project.owner.initials}</AvatarFallback>\n                    </Avatar>\n                    {project.owner.name}\n                  </span>\n                </TableCell>\n                <TableCell className=\"hidden text-right text-muted-foreground @xl/app-shell:table-cell\">\n                  {project.updated}\n                </TableCell>\n              </TableRow>\n            ))}\n          </TableBody>\n        </Table>\n      </div>\n    </div>\n  )\n}\n\nfunction InboxPage({\n  messages,\n  onMarkAllRead,\n}: {\n  messages: Message[]\n  onMarkAllRead: () => void\n}) {\n  return (\n    <div className=\"flex flex-col gap-6\">\n      <PageHeader\n        title=\"Inbox\"\n        description={\n          messages.length\n            ? `${messages.length} unread`\n            : \"Nothing new since you last looked.\"\n        }\n        action={\n          messages.length ? (\n            <Button variant=\"outline\" onClick={onMarkAllRead}>\n              <CheckCheckIcon data-icon=\"inline-start\" />\n              Mark all as read\n            </Button>\n          ) : null\n        }\n      />\n      {messages.length ? (\n        <ul className=\"m-0 flex list-none flex-col divide-y divide-border rounded-xl border border-border p-0\">\n          {messages.map((message) => (\n            <li key={message.id} className=\"flex items-center gap-3 px-4 py-3\">\n              <Avatar>\n                <AvatarFallback>{message.from.initials}</AvatarFallback>\n              </Avatar>\n              <span className=\"flex min-w-0 flex-1 flex-col\">\n                <span className=\"truncate text-sm font-medium text-foreground\">\n                  {message.subject}\n                </span>\n                <span className=\"truncate text-xs text-muted-foreground\">\n                  {message.from.name}\n                </span>\n              </span>\n              <span className=\"shrink-0 text-xs text-muted-foreground\">\n                {message.received}\n              </span>\n            </li>\n          ))}\n        </ul>\n      ) : (\n        <EmptyState className=\"rounded-xl border border-dashed border-border py-12\">\n          <EmptyStateMedia>\n            <InboxIcon />\n          </EmptyStateMedia>\n          <EmptyStateTitle>{\"You're all caught up\"}</EmptyStateTitle>\n          <EmptyStateDescription>\n            New messages from your projects land here.\n          </EmptyStateDescription>\n        </EmptyState>\n      )}\n    </div>\n  )\n}\n\nexport { HomePage, InboxPage, ProjectsPage }\n",
      "type": "registry:component",
      "target": "components/blocks/app-shell/pages.tsx"
    }
  ],
  "cssVars": {
    "theme": {
      "color-ring-subtle": "var(--ring-subtle)"
    },
    "light": {
      "ring-subtle": "color-mix(in oklch, var(--color-neutral-400) 50%, transparent)"
    },
    "dark": {
      "ring-subtle": "color-mix(in oklch, var(--color-neutral-500) 50%, transparent)"
    }
  },
  "meta": {
    "tier": "blocks",
    "group": "Shells",
    "docs": "https://fibo.toribryan.com/?path=/docs/blocks-app-shell--docs"
  },
  "docs": "Installed into components/blocks/app-shell. Render <AppShell /> where the screen goes, then edit it: it's yours. Docs: https://fibo.toribryan.com/?path=/docs/blocks-app-shell--docs",
  "categories": [
    "blocks",
    "shells"
  ],
  "type": "registry:block"
}