AppShell
packages/ui/src/components/layout/AppShell.tsx
Import
Subpath export:
@marktiderman/genesis-ui/layoutimport { AppShell } from "@marktiderman/genesis-ui/layout";Components
Auto-generated from TypeScript source via
react-docgen-typescript.AppShell
| Prop | Type | Default | Description |
|---|---|---|---|
| appName* | string | — | App name shown in sidebar header |
| children* | ReactNode | — | Page content |
| activePath | string | — | Current location used to highlight the active nav item. Pass the full location, `pathname + search + hash` (React Router: `useLocation()`), so items whose `to` names a query or hash (`/admin?tab=users`) can become active. A pathname alone still works for path-only items, `end` included. Omit to disable active highlighting. |
| appLogo | string | — | App logo letter or short text (ignored when `logo` is set) |
| collapsed | boolean | — | Controlled collapse (desktop rail). Overrides the stored user choice and every default. |
| collapsedHeaderSlot | ReactNode | — | Compact slot shown in the **collapsed** desktop rail, where `headerSlot` is hidden for space. Use it to keep a core affordance reachable without expanding — e.g. an icon-only product switcher. Omit to hide the header region entirely while collapsed. |
| defaultCollapsed | boolean | — | This page's default: open the desktop sidebar collapsed (`true`) or expanded (`false`) until the user toggles it. Reactive, so a layout can pass it per route. Wins over `navigation`'s `defaultCollapsed` and `options.defaultCollapsed`; the user's own choice (persisted under `optionsStorageKey`) wins over all of them. @stability Beta |
| dock | ReactNode | — | Docked panels that stay open across pages, bottom-right: genesis-chat's `ChatDock`. Fixed outside the scrolling page, above it, and lifted clear of the phone's bottom bar. The region lets clicks through; the dock's own windows take them. @stability Beta |
| footer | ReactNode | — | Footer region above the user slot (version, links) |
| headerItems | NavItem[] | — | Links for the top bar (a "top" menu location: Help, a booking page, a site). Drawn at the end of the top-tabs bar, in a thin row above the page on other wide layouts, and in the phone's drawer. @stability Beta |
| headerSlot | ReactNode | — | Slot below the logo row (product switcher, workspace picker, …) |
| isActive | ((to: string, activePath?: string) => boolean) | — | Optional custom active-state matcher. Defaults to a prefix match (with `/` treated as exact), mirroring React Router `NavLink`. The sub-navigation levels above the page read it on navigation: a new matcher alone, with no `activePath` change, applies from the next navigation. |
| linkComponent | LinkComponent | ({ href, children, testID, ...rest }) => ( <a href={href} data-testid={testID} {...rest}> {children} </a> ) | Injectable link component. Defaults to a plain `<a>` (no router). Pass a router adapter — e.g. React Router `({ href, ...p }) => <Link to={href} {...p} />` or Next.js `next/link` — to get client-side navigation. |
| logo | ReactNode | — | Custom logo node — preferred over `appLogo` letter tile |
| mobileHeaderSlot | ReactNode | — | Replaces the app name in the phone's top bar: a workspace switcher (`WorkspaceSwitcher variant="bar"`), so the viewer always sees where they are working. @stability Beta |
| mobileNavItems | NavItem[] | — | Items for the mobile bottom tab bar. Defaults to top-level `navItems` (no children). Pass a short list for apps with large sidebars; pass `[]` and set `options.showMobileBottomNav: false` to hide. |
| navigation | NavigationNode<NavItem> | — | The app's logical navigation hierarchy. AppShell resolves it against `activePath` (see `resolveNavigation`) and derives: - the sidebar's global items from the root's `items` (unless `navItems`), - a contextual section from the current node's `items`, labelled with the node's `label` (`$param` segments in `to` filled from the URL), - the mobile tab bar: the contextual items when there are any, else the global top-level items (unless `mobileNavItems`), - a back link to the current node's logical parent (unless `parentNavigation`). @stability Beta |
| navItems | NavItem[] | — | Primary navigation items. Optional when `navigation` is set: the tree root's `items` are the global nav then. |
| onCollapsedChange | ((collapsed: boolean) => void) | — | Called with the new state whenever the user toggles the sidebar. |
| options | AppShellOptions | — | Chrome config (developer defaults + optional in-sidebar menu) |
| optionsStorageKey | string | — | Persist user sidebar-option overrides + collapse state (localStorage) |
| parentNavigation | ParentNavigation | null | — | Back-to-parent link rendered in the content header, above `children`, on mobile and desktop. Derived from `navigation` when omitted; `null` hides it. Use this instead of placing a back row inside page content. @stability Beta |
| secondaryNavItems | NavItem[] | — | Secondary nav (e.g. “More”) — rendered below a divider when shown |
| secondaryNavLabel | string | More | Label above secondary nav (default “More”) |
| showThemeToggle | boolean | — | @deprecated Prefer `options.showThemeToggle`. Kept for sample-app back-compat; merges into resolved options when `options` omits it. |
| subNav | enum | — | This page's sub-navigation mode (see `AppShellOptions.subNav`). Wins over `navigation`'s `subNav` and `options.subNav`; the page's own `useAppShellSubNav(items, { mode })` wins over it. @stability Beta |
| subNavLabel | string | — | Accessible name of the sub-navigation tab row. Defaults to the current navigation node's label, else "Page sections". |
| userSlot | ReactNode | — | User / account block at the bottom of the sidebar. When the rail is collapsed, AppShell hides any descendant carrying the `data-shell-user-detail` attribute (e.g. name/email text) so only a compact element (avatar, initial) remains — tag the detail wrapper you want hidden in the collapsed rail with that attribute. |