{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "app-shell-stacked",
  "title": "App Shell, Stacked Layout",
  "description": "An application shell with everything stacked on top: a top bar with brand, main navigation and a sliding underline, search, a notifications dropdown with unread dots and an account menu, then a page header with breadcrumb, title, favourite star, status, actions and section tabs, and a hamburger menu on phones.",
  "dependencies": [
    "motion",
    "clsx",
    "tailwind-merge"
  ],
  "files": [
    {
      "path": "registry/new-york/app-shell-stacked/app-shell-stacked.tsx",
      "content": "\"use client\";\n\nimport * as React from \"react\";\nimport { AnimatePresence, motion, useReducedMotion } from \"motion/react\";\nimport { clsx, type ClassValue } from \"clsx\";\nimport { twMerge } from \"tailwind-merge\";\n\nfunction cn(...inputs: ClassValue[]) {\n  return twMerge(clsx(inputs));\n}\n\nexport interface StackedNotification {\n  id: string;\n  text: string;\n  time: string;\n  unread?: boolean;\n}\n\nexport interface AppShellStackedProps {\n  brand?: string;\n  nav?: string[];\n  tabs?: string[];\n  page?: { title: string; breadcrumb: string[]; status: string; meta: string };\n  notifications?: StackedNotification[];\n  user?: { name: string; email: string; avatar?: string };\n  children?: React.ReactNode;\n  theme?: \"dark\" | \"light\";\n  className?: string;\n}\n\nconst PALETTES = {\n  dark: { bg: \"#0A0A0A\", text: \"#F5F4F1\", muted: \"rgba(245,244,241,0.62)\", faint: \"rgba(245,244,241,0.36)\", top: \"#0E0E0E\", band: \"#111111\", main: \"#141414\", border: \"rgba(255,255,255,0.08)\", chip: \"rgba(255,255,255,0.06)\", hover: \"rgba(255,255,255,0.045)\", skel: \"rgba(255,255,255,0.045)\", on: \"#F5F4F1\", onText: \"#0A0A0A\", accent: \"#FB923C\", green: \"#4ADE80\", ring: \"rgba(245,244,241,0.6)\", pop: \"#181818\", shadow: \"0 20px 50px -16px rgba(0,0,0,0.8)\" },\n  light: { bg: \"#F4F4F1\", text: \"#0A0A0A\", muted: \"rgba(10,10,10,0.62)\", faint: \"rgba(10,10,10,0.4)\", top: \"#FFFFFF\", band: \"#FAFAF8\", main: \"#FFFFFF\", border: \"rgba(10,10,10,0.08)\", chip: \"rgba(10,10,10,0.05)\", hover: \"rgba(10,10,10,0.035)\", skel: \"rgba(10,10,10,0.05)\", on: \"#0A0A0A\", onText: \"#FAFAF8\", accent: \"#EA580C\", green: \"#15803D\", ring: \"rgba(10,10,10,0.5)\", pop: \"#FFFFFF\", shadow: \"0 20px 50px -20px rgba(0,0,0,0.25)\" },\n};\n\nconst DEFAULT_NOTIFS: StackedNotification[] = [\n  { id: \"n1\", text: \"Daniel approved the Q4 budget\", time: \"5m\", unread: true },\n  { id: \"n2\", text: \"Lena commented on Brand refresh\", time: \"1h\", unread: true },\n  { id: \"n3\", text: \"Weekly report is ready\", time: \"Yesterday\" },\n];\nconst DEFAULT_PAGE = { title: \"Website v3 launch\", breadcrumb: [\"Projects\", \"Marketing\"], status: \"On track\", meta: \"Updated 12 minutes ago by Mara\" };\nconst DEFAULT_USER = { name: \"Mara Okafor\", email: \"mara@nexora.io\", avatar: \"/demo/44.webp\" };\n\nexport function AppShellStacked({ brand = \"Nexora\", nav = [\"Dashboard\", \"Projects\", \"Team\", \"Calendar\", \"Reports\"], tabs = [\"Overview\", \"Tasks\", \"Files\", \"Activity\", \"Settings\"], page = DEFAULT_PAGE, notifications = DEFAULT_NOTIFS, user = DEFAULT_USER, children, theme = \"dark\", className }: AppShellStackedProps) {\n  const p = PALETTES[theme];\n  const reduce = !!useReducedMotion();\n  const uid = React.useId();\n  const [navActive, setNavActive] = React.useState(nav[1] ?? nav[0]);\n  const [tab, setTab] = React.useState(tabs[0]);\n  const [menu, setMenu] = React.useState<\"notif\" | \"user\" | null>(null);\n  const [mobile, setMobile] = React.useState(false);\n  const [notifs, setNotifs] = React.useState(notifications);\n  const [starred, setStarred] = React.useState(false);\n\n  React.useEffect(() => {\n    if (!menu && !mobile) return;\n    const down = (e: MouseEvent) => {\n      if (!(e.target as HTMLElement).closest(\"[data-menu]\")) setMenu(null);\n    };\n    const key = (e: KeyboardEvent) => {\n      if (e.key === \"Escape\") {\n        setMenu(null);\n        setMobile(false);\n      }\n    };\n    document.addEventListener(\"mousedown\", down);\n    document.addEventListener(\"keydown\", key);\n    return () => {\n      document.removeEventListener(\"mousedown\", down);\n      document.removeEventListener(\"keydown\", key);\n    };\n  }, [menu, mobile]);\n\n  const unread = notifs.filter((n) => n.unread).length;\n  const ring = { [\"--tw-ring-color\" as string]: p.ring, [\"--tw-ring-offset-color\" as string]: p.top } as React.CSSProperties;\n  const focus = \"outline-none focus-visible:ring-2 focus-visible:ring-offset-2\";\n  const iconBtn = cn(\"relative flex h-8 w-8 cursor-pointer items-center justify-center rounded-lg border-0 bg-transparent hover:bg-[var(--st-h)]\", focus);\n  const avatar = (size: number) =>\n    user.avatar ? (\n      // eslint-disable-next-line @next/next/no-img-element\n      <img src={user.avatar} alt=\"\" className=\"shrink-0 rounded-full object-cover\" style={{ width: size, height: size }} />\n    ) : (\n      <span className=\"flex shrink-0 items-center justify-center rounded-full text-[11px] font-semibold\" style={{ width: size, height: size, background: p.chip }}>\n        {user.name[0]}\n      </span>\n    );\n\n  return (\n    <section className={cn(\"@container w-full\", className)} style={{ background: p.bg, color: p.text }}>\n      <div className=\"mx-auto max-w-6xl px-4 py-10 @[640px]:px-6 @[640px]:py-14\">\n        <div className=\"relative flex h-[620px] flex-col overflow-hidden rounded-2xl border\" style={{ background: p.main, borderColor: p.border, [\"--st-h\" as string]: p.hover }}>\n          {/* Top bar */}\n          <header className=\"relative z-20 flex h-14 shrink-0 items-center gap-2 border-b px-3 @[640px]:px-5\" style={{ background: p.top, borderColor: p.border }}>\n            <button type=\"button\" aria-label={mobile ? \"Close menu\" : \"Open menu\"} aria-expanded={mobile} aria-controls={`${uid}-mnav`} onClick={() => setMobile((m) => !m)} className={cn(iconBtn, \"@[760px]:hidden\")} style={{ color: p.muted, ...ring }}>\n              <svg width=\"17\" height=\"17\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"1.8\" strokeLinecap=\"round\" aria-hidden=\"true\">\n                {mobile ? <path d=\"m6 6 12 12M18 6 6 18\" /> : <path d=\"M4 7h16M4 12h16M4 17h16\" />}\n              </svg>\n            </button>\n            <span className=\"flex items-center gap-2 pr-3 text-[15px] font-semibold tracking-[-0.01em]\">\n              <span className=\"flex h-6 w-6 items-center justify-center rounded-md text-[11px] font-bold\" style={{ background: p.accent, color: \"#0A0A0A\" }} aria-hidden=\"true\">\n                {brand[0]}\n              </span>\n              {brand}\n            </span>\n            <nav aria-label=\"Main\" className=\"hidden h-full @[760px]:block\">\n              <ul className=\"m-0 flex h-full list-none items-stretch gap-1 p-0\">\n                {nav.map((n) => (\n                  <li key={n} className=\"relative flex\">\n                    <button type=\"button\" aria-current={navActive === n ? \"page\" : undefined} onClick={() => setNavActive(n)} className={cn(\"cursor-pointer rounded-md border-0 bg-transparent px-3 text-[13.5px]\", focus)} style={{ color: navActive === n ? p.text : p.muted, ...ring }}>\n                      {n}\n                    </button>\n                    {navActive === n && <motion.span layoutId={`${uid}-nav`} className=\"absolute inset-x-2 -bottom-px h-[2px] rounded-full\" style={{ background: p.accent }} transition={reduce ? { duration: 0 } : { type: \"spring\", stiffness: 500, damping: 38 }} />}\n                  </li>\n                ))}\n              </ul>\n            </nav>\n            <div className=\"ml-auto flex items-center gap-1\">\n              <button type=\"button\" aria-label=\"Search\" className={iconBtn} style={{ color: p.muted, ...ring }}>\n                <svg width=\"16\" height=\"16\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"1.8\" strokeLinecap=\"round\" aria-hidden=\"true\">\n                  <circle cx=\"11\" cy=\"11\" r=\"7\" />\n                  <path d=\"m20 20-3.5-3.5\" />\n                </svg>\n              </button>\n              <div className=\"relative\" data-menu>\n                <button type=\"button\" aria-label={`Notifications${unread ? `, ${unread} unread` : \"\"}`} aria-haspopup=\"true\" aria-expanded={menu === \"notif\"} onClick={() => setMenu(menu === \"notif\" ? null : \"notif\")} className={iconBtn} style={{ color: p.muted, background: menu === \"notif\" ? p.chip : undefined, ...ring }}>\n                  <motion.svg width=\"16\" height=\"16\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"1.8\" strokeLinecap=\"round\" strokeLinejoin=\"round\" aria-hidden=\"true\" animate={unread && !reduce ? { rotate: [0, -14, 12, -8, 0] } : { rotate: 0 }} transition={{ duration: 0.7, repeat: unread ? Infinity : 0, repeatDelay: 4 }}>\n                    <path d=\"M6 9a6 6 0 1 1 12 0c0 6 2.5 7.5 2.5 7.5h-17S6 15 6 9Z\" />\n                    <path d=\"M10 20a2 2 0 0 0 4 0\" />\n                  </motion.svg>\n                  {unread > 0 && <span className=\"absolute top-1.5 right-1.5 h-2 w-2 rounded-full border-2\" style={{ background: p.accent, borderColor: p.top }} aria-hidden=\"true\" />}\n                </button>\n                <AnimatePresence>\n                  {menu === \"notif\" && (\n                    <motion.div initial={reduce ? false : { opacity: 0, y: -4 }} animate={{ opacity: 1, y: 0 }} exit={reduce ? undefined : { opacity: 0, y: -4 }} transition={{ duration: 0.14 }} className=\"absolute right-0 mt-2 w-72 rounded-xl border p-1.5\" style={{ background: p.pop, borderColor: p.border, boxShadow: p.shadow }} role=\"dialog\" aria-label=\"Notifications\">\n                      <div className=\"flex items-center justify-between px-2 pt-1 pb-1.5\">\n                        <span className=\"text-[13px] font-semibold\">Notifications</span>\n                        <button type=\"button\" disabled={!unread} onClick={() => setNotifs((n) => n.map((x) => ({ ...x, unread: false })))} className={cn(\"cursor-pointer rounded border-0 bg-transparent text-[12px] disabled:cursor-default disabled:opacity-40\", focus)} style={{ color: p.muted, ...ring }}>\n                          Mark all read\n                        </button>\n                      </div>\n                      <ul className=\"m-0 list-none p-0\">\n                        {notifs.map((n) => (\n                          <li key={n.id}>\n                            <button type=\"button\" onClick={() => setNotifs((l) => l.map((x) => (x.id === n.id ? { ...x, unread: false } : x)))} className={cn(\"flex w-full cursor-pointer items-start gap-2.5 rounded-lg border-0 bg-transparent px-2 py-2 text-left hover:bg-[var(--st-h)]\", focus)} style={{ color: p.text, ...ring }}>\n                              <span className=\"mt-1.5 h-1.5 w-1.5 shrink-0 rounded-full\" style={{ background: n.unread ? p.accent : \"transparent\" }} aria-hidden=\"true\" />\n                              <span className=\"min-w-0 flex-1 text-[13px]\" style={{ color: n.unread ? p.text : p.muted }}>\n                                {n.text}\n                                {n.unread && <span className=\"sr-only\">, unread</span>}\n                              </span>\n                              <span className=\"shrink-0 text-[11.5px]\" style={{ color: p.faint }}>\n                                {n.time}\n                              </span>\n                            </button>\n                          </li>\n                        ))}\n                      </ul>\n                    </motion.div>\n                  )}\n                </AnimatePresence>\n              </div>\n              <div className=\"relative ml-1\" data-menu>\n                <button type=\"button\" aria-label=\"Account\" aria-haspopup=\"menu\" aria-expanded={menu === \"user\"} onClick={() => setMenu(menu === \"user\" ? null : \"user\")} className={cn(\"flex cursor-pointer rounded-full border-0 bg-transparent p-0.5\", focus)} style={ring}>\n                  {avatar(28)}\n                </button>\n                <AnimatePresence>\n                  {menu === \"user\" && (\n                    <motion.div initial={reduce ? false : { opacity: 0, y: -4 }} animate={{ opacity: 1, y: 0 }} exit={reduce ? undefined : { opacity: 0, y: -4 }} transition={{ duration: 0.14 }} className=\"absolute right-0 mt-2 w-56 rounded-xl border p-1.5\" style={{ background: p.pop, borderColor: p.border, boxShadow: p.shadow }} role=\"menu\">\n                      <div className=\"px-2.5 pt-1.5 pb-2\">\n                        <p className=\"m-0 text-[13px] font-medium\">{user.name}</p>\n                        <p className=\"m-0 text-[12px]\" style={{ color: p.faint }}>\n                          {user.email}\n                        </p>\n                      </div>\n                      <div className=\"mb-1 h-px\" style={{ background: p.border }} />\n                      {[\"Your profile\", \"Settings\", \"Sign out\"].map((l) => (\n                        <button key={l} type=\"button\" role=\"menuitem\" onClick={() => setMenu(null)} className={cn(\"flex w-full cursor-pointer rounded-lg border-0 bg-transparent px-2.5 py-1.5 text-left text-[13px] hover:bg-[var(--st-h)]\", focus)} style={{ color: l === \"Sign out\" ? \"#F87171\" : p.text, ...ring }}>\n                          {l}\n                        </button>\n                      ))}\n                    </motion.div>\n                  )}\n                </AnimatePresence>\n              </div>\n            </div>\n          </header>\n\n          {/* Mobile nav */}\n          <AnimatePresence>\n            {mobile && (\n              <motion.nav id={`${uid}-mnav`} aria-label=\"Main\" initial={reduce ? false : { height: 0, opacity: 0 }} animate={{ height: \"auto\", opacity: 1 }} exit={reduce ? undefined : { height: 0, opacity: 0 }} className=\"absolute inset-x-0 top-14 z-10 overflow-hidden border-b @[760px]:hidden\" style={{ background: p.top, borderColor: p.border, boxShadow: p.shadow }}>\n                <ul className=\"m-0 flex list-none flex-col gap-0.5 p-2\">\n                  {nav.map((n) => (\n                    <li key={n}>\n                      <button\n                        type=\"button\"\n                        aria-current={navActive === n ? \"page\" : undefined}\n                        onClick={() => {\n                          setNavActive(n);\n                          setMobile(false);\n                        }}\n                        className={cn(\"flex w-full cursor-pointer items-center rounded-lg border-0 px-3 py-2.5 text-left text-[14px]\", focus)}\n                        style={{ background: navActive === n ? p.chip : \"transparent\", color: navActive === n ? p.text : p.muted, ...ring }}\n                      >\n                        {navActive === n && <span className=\"mr-2.5 h-4 w-[3px] rounded-full\" style={{ background: p.accent }} aria-hidden=\"true\" />}\n                        {n}\n                      </button>\n                    </li>\n                  ))}\n                </ul>\n                <div className=\"flex items-center gap-3 border-t px-4 py-3\" style={{ borderColor: p.border }}>\n                  {avatar(32)}\n                  <span>\n                    <span className=\"block text-[13px] font-medium\">{user.name}</span>\n                    <span className=\"block text-[12px]\" style={{ color: p.faint }}>\n                      {user.email}\n                    </span>\n                  </span>\n                </div>\n              </motion.nav>\n            )}\n          </AnimatePresence>\n\n          {/* Page header */}\n          <div className=\"shrink-0 border-b px-4 pt-5 @[640px]:px-8\" style={{ background: p.band, borderColor: p.border }}>\n            <nav aria-label=\"Breadcrumb\">\n              <ol className=\"m-0 flex list-none flex-wrap items-center gap-1.5 p-0 text-[12.5px]\" style={{ color: p.faint }}>\n                {[navActive, ...page.breadcrumb.slice(1)].map((b) => (\n                  <React.Fragment key={b}>\n                    <li>{b}</li>\n                    <li aria-hidden=\"true\">/</li>\n                  </React.Fragment>\n                ))}\n                <li aria-current=\"page\" style={{ color: p.muted }}>\n                  {page.title}\n                </li>\n              </ol>\n            </nav>\n            <div className=\"mt-2 flex flex-wrap items-start justify-between gap-3\">\n              <div className=\"min-w-0\">\n                <h1 className=\"m-0 flex items-center gap-2 text-[22px] font-semibold tracking-[-0.02em]\">\n                  {page.title}\n                  <button type=\"button\" aria-pressed={starred} aria-label={starred ? \"Remove from favorites\" : \"Add to favorites\"} onClick={() => setStarred((s) => !s)} className={cn(\"flex h-7 w-7 cursor-pointer items-center justify-center rounded-md border-0 bg-transparent\", focus)} style={{ color: starred ? \"#FBBF24\" : p.faint, ...ring }}>\n                    <motion.svg width=\"15\" height=\"15\" viewBox=\"0 0 24 24\" fill={starred ? \"currentColor\" : \"none\"} stroke=\"currentColor\" strokeWidth=\"1.8\" strokeLinejoin=\"round\" aria-hidden=\"true\" animate={starred && !reduce ? { scale: [1, 1.3, 1] } : { scale: 1 }}>\n                      <path d=\"m12 3 2.8 5.7 6.2.9-4.5 4.4 1 6.2L12 17.3 6.5 20.2l1-6.2L3 9.6l6.2-.9L12 3Z\" />\n                    </motion.svg>\n                  </button>\n                </h1>\n                <p className=\"m-0 mt-1 flex flex-wrap items-center gap-2 text-[12.5px]\" style={{ color: p.faint }}>\n                  <span className=\"inline-flex items-center gap-1.5 rounded-full px-2 py-0.5 font-medium\" style={{ background: p.chip, color: p.green }}>\n                    <span className=\"h-1.5 w-1.5 rounded-full\" style={{ background: p.green }} aria-hidden=\"true\" />\n                    {page.status}\n                  </span>\n                  {page.meta}\n                </p>\n              </div>\n              <div className=\"flex gap-2\">\n                <button type=\"button\" className={cn(\"h-9 cursor-pointer rounded-lg border bg-transparent px-3.5 text-[13px]\", focus)} style={{ borderColor: p.border, color: p.text, ...ring }}>\n                  Share\n                </button>\n                <button type=\"button\" className={cn(\"h-9 cursor-pointer rounded-lg border-0 px-3.5 text-[13px] font-medium\", focus)} style={{ background: p.on, color: p.onText, ...ring }}>\n                  New task\n                </button>\n              </div>\n            </div>\n            <div role=\"tablist\" aria-label=\"Page sections\" className=\"mt-4 -mb-px flex gap-1 overflow-x-auto\">\n              {tabs.map((t) => (\n                <button key={t} type=\"button\" role=\"tab\" aria-selected={tab === t} onClick={() => setTab(t)} className={cn(\"relative shrink-0 cursor-pointer border-0 bg-transparent px-3 pt-1 pb-3 text-[13px]\", focus)} style={{ color: tab === t ? p.text : p.muted, ...ring }}>\n                  {t}\n                  {tab === t && <motion.span layoutId={`${uid}-tab`} className=\"absolute inset-x-2 bottom-0 h-[2px] rounded-full\" style={{ background: p.on }} transition={reduce ? { duration: 0 } : { type: \"spring\", stiffness: 500, damping: 38 }} />}\n                </button>\n              ))}\n            </div>\n          </div>\n\n          {/* Content */}\n          <main role=\"tabpanel\" aria-label={tab} className=\"min-h-0 flex-1 overflow-y-auto px-4 py-6 @[640px]:px-8\">\n            {children ?? (\n              <AnimatePresence mode=\"wait\" initial={false}>\n                <motion.div key={`${navActive}-${tab}`} initial={reduce ? false : { opacity: 0, y: 6 }} animate={{ opacity: 1, y: 0 }} exit={reduce ? undefined : { opacity: 0 }} transition={{ duration: 0.18 }} className=\"grid gap-4 @[720px]:grid-cols-[1fr_280px]\" aria-hidden=\"true\">\n                  <div className=\"flex flex-col gap-3\">\n                    <div className=\"h-40 rounded-xl\" style={{ background: p.skel }} />\n                    {[0, 1, 2].map((i) => (\n                      <div key={i} className=\"flex h-14 items-center gap-3 rounded-xl px-4\" style={{ background: p.skel }}>\n                        <span className=\"h-4 w-4 rounded\" style={{ background: p.chip }} />\n                        <span className=\"h-2.5 rounded-full\" style={{ width: `${[52, 38, 46][i]}%`, background: p.chip }} />\n                      </div>\n                    ))}\n                  </div>\n                  <div className=\"flex flex-col gap-3\">\n                    <div className=\"h-28 rounded-xl\" style={{ background: p.skel }} />\n                    <div className=\"h-44 rounded-xl\" style={{ background: p.skel }} />\n                  </div>\n                </motion.div>\n              </AnimatePresence>\n            )}\n          </main>\n        </div>\n      </div>\n    </section>\n  );\n}\n\nexport default AppShellStacked;\n",
      "type": "registry:component"
    }
  ],
  "type": "registry:component"
}