Repository navigation
Description
Spec (revised 2026-02-21)
Application-level layout shell that provides the structural frame for an app: header, sidebar navigation, and main content area. Composes XDSLayout internally. Replaces internal XDSPage + XDSPageLayout pattern.
This is a dedicated component, separate from XDSLayout. AppShell is an opinionated app-level orchestrator that composes Layout under the hood. Layout remains the generic spatial primitive.
Internal API analysis
Internal XDSPage (8,585 usages) and XDSPageLayout (7,374 usages) work together:
XDSPage:
- Top-level wrapper for the entire application page
- Manages global layout (header bar, content area)
- Renders
XDSTopNavin the header slot - Handles page-level scroll behavior
XDSPageLayout:
- Content-area layout within XDSPage
- Manages sidebar navigation (
XDSPageNav) + main content split - Sidebar collapse/expand behavior
- Responsive breakpoints for sidebar visibility
- Content area scroll containment
Combined pattern:
<XDSPage topNav={<XDSTopNav ... />}>
<XDSPageLayout pageNav={<XDSPageNav ... />}>
{mainContent}
</XDSPageLayout>
</XDSPage>External comparison
| Feature | Mantine (AppShell) | Ant (Layout) | shadcn (Sidebar) | XDS (proposed) |
|---|---|---|---|---|
| API style | Compound component | Compound component | Composition | Slot props |
| Areas | Header, Navbar, Aside, Footer, Main | Header, Sider, Content, Footer | Sidebar + content | topNav, pageNav, topBanner, children |
| Sidebar collapse | navbar.collapsed |
Sider.collapsed |
Manual | isSidebarCollapsed |
| Responsive | navbar.breakpoint |
Sider.breakpoint |
Manual | sidebarBreakpoint |
| Scroll behavior | Main area scrolls | Content scrolls | Manual | Mode-dependent (fill/auto) |
| Padding | padding prop |
Manual | Manual | Inherited from XDSLayout |
| Sticky nav | Manual | Manual | Manual | Built-in, mode-aware |
| Built-in providers | None | None | None | Theme, Prose, Layer |
Key decisions
| Decision | Choice | Rationale |
|---|---|---|
| Dedicated component | Yes, separate from XDSLayout | AppShell is an opinionated app-level orchestrator; Layout is a generic spatial primitive. Helps discoverability. |
| Composes XDSLayout | Internally uses Layout | Gets smart padding, isFullBleed, slot awareness for free. No separate system. |
Content renders as <main> |
Yes | Semantic HTML landmark. AppShell content is always the primary content area. |
| Built-in providers | ThemeProvider, ProseProvider, future LayerProvider | Makes AppShell a true "just wrap your app in this" entry point. Enables imperative components like toasts out of the box. |
| Top banner slot | Yes | Common pattern for system-wide announcements (uses XDSBanner). |
| Naming convention | XDSAppShellHeader (flat) not XDSAppShell.Header |
Consistent with XDS naming conventions. |
| Slot-based API | topNav and pageNav props |
Directly composes XDSTopNav and XDSPageNav in named slots rather than generic sub-components. Closer to internal XDSPage pattern. |
| Sidebar visual treatment | Controlled by slot components, not the shell | Product teams think about how a specific area looks, not spacing relationships. Margin collapse is a consequence of slot appearance, handled by Layout. |
| ViewTransitions | Use for sidebar collapse/expand animations | Avoids layout thrash from animating large areas. |
| Default height mode | fill (100dvh) |
AppShell is an app shell — fill is the 80% case. auto available for content-heavy pages. |
| Sticky nav behavior | Built-in, mode-aware | Shell controls the full structure so it can apply sticky correctly. In fill mode: navs are naturally pinned. In auto mode: shell applies position: sticky with correct top offsets. |
| Sidebar on mobile | Overlay with backdrop | Doesn't reflow content. Standard mobile nav pattern. |
| Default sidebar width | 260px | Matches 70% of internal usage. |
Proposed API
interface XDSAppShellProps {
/** Top navigation — typically an XDSTopNav */
topNav?: ReactNode;
/** Sidebar navigation — typically an XDSPageNav */
pageNav?: ReactNode;
/** Optional top banner slot for system-wide announcements */
topBanner?: ReactNode;
/** Main content area (rendered as <main>) */
children: ReactNode;
/** Height behavior:
* - `fill`: Shell fills viewport, content scrolls internally (default)
* - `auto`: Shell grows with content, page scrolls as a whole
* @default 'fill' */
height?: 'fill' | 'auto';
/** Whether the sidebar is collapsed (controlled) */
isSidebarCollapsed?: boolean;
/** Initial collapsed state (uncontrolled) */
initialIsSidebarCollapsed?: boolean;
/** Collapse change callback */
onSidebarCollapsedChange?: (isCollapsed: boolean) => void;
/** Breakpoint below which sidebar auto-collapses
* @default 'md' */
sidebarBreakpoint?: 'sm' | 'md' | 'lg' | 'none';
/** Width of sidebar when expanded
* @default 260 */
sidebarWidth?: number;
/** StyleX overrides */
xstyle?: StyleXStyles;
'data-testid'?: string;
}Usage
// Standard app shell — fill mode, sidebar + header
<XDSAppShell
topNav={<XDSTopNav title="My App" ... />}
pageNav={<XDSPageNav items={navItems} />}
topBanner={<XDSBanner status="info" title="System update scheduled" />}
>
<DashboardContent />
</XDSAppShell>
// Header only (no sidebar)
<XDSAppShell topNav={<XDSTopNav title="Landing" />}>
<LandingContent />
</XDSAppShell>
// Auto-height for content-heavy pages (page scrolls, sticky header)
<XDSAppShell
topNav={<XDSTopNav title="Docs" />}
pageNav={<XDSPageNav items={docNav} />}
height="auto"
>
<LongDocumentContent />
</XDSAppShell>Height modes & sticky behavior
Fill mode (default):
- Shell takes full viewport height (
100dvh) - TopNav is part of the grid — naturally pinned at top, no sticky needed
- PageNav gets its own scroll container within its grid area
- Content area scrolls independently via
XDSLayoutContent - Best for: dashboards, admin panels, tools
Auto mode:
- Shell grows with content, the page itself scrolls
- TopNav gets
position: sticky; top: 0applied by the shell - PageNav gets
position: sticky; top: <header-height>— sticks below header as page scrolls - Shell measures/sets header height via CSS variable for correct PageNav offset
- Best for: docs sites, content-heavy pages, pages needing sticky sub-elements
Why the shell handles sticky: AppShell controls the full structure, so it knows where navs sit and can apply sticky with correct offsets. Product teams don't need to think about which scroll container they're in or calculate offsets. The shell does the right thing for each mode.
What AppShell provides out of the box
- Semantic HTML:
<header>for topNav,<nav>for pageNav,<main>for content - Built-in providers: ThemeProvider, ProseProvider, LayerProvider (future)
- Smart padding: Inherited from XDSLayout — context-aware padding with
isFullBleedopt-out - Scroll containment: Mode-dependent — fill mode has independent scroll containers, auto mode uses page scroll
- Sticky navigation: Correctly applied in both modes without consumer effort
- Responsive collapse: Sidebar auto-collapses at breakpoint, overlay on mobile with backdrop
- Skip-to-content link: Visually hidden, shown on focus
- ViewTransitions: For sidebar collapse/expand animations
Margin collapse (deferred to Layout refinement)
The Layout system will be refined separately to be background-aware:
- Slot components declare their visual treatment via variants (e.g.,
XDSPageNav variant="surface") - Layout reads this (via CSS variable like
--layout-area-bg: distinct | inherit) and adjusts padding collapse - Same background + no divider → collapse gap
- Different backgrounds → keep gap (color change is the separator)
- Divider present → keep gap
This is a Layout-level improvement that benefits all Layout consumers, not just AppShell.
Accessibility
- Shell uses semantic HTML:
<header>,<nav>,<main> <main>has implicitrole="main"for landmark navigation- Sidebar
<nav>hasaria-label="Application navigation" - Skip-to-content link at the top of the shell (visually hidden, shown on focus)
- Sidebar collapse/expand announced via
aria-expandedon toggle button - Mobile sidebar overlay has focus trap
- Escape closes mobile sidebar overlay
- Reduced motion: transitions respect
prefers-reduced-motion
v1 scope
Include:
- Slot props:
topNav,pageNav,topBanner,children heightprop:fill(default) andautomodes- Composes XDSLayout internally
- Content rendered as
<main> - Built-in ThemeProvider, ProseProvider
- Mode-aware sticky nav behavior
- Sidebar collapse (controlled + uncontrolled)
- Responsive sidebar collapse via breakpoint
- Mobile overlay sidebar with backdrop
- ViewTransitions for sidebar animations
- Skip-to-content link
xstyleanddata-testid
Defer:
- Footer slot
- Aside/right panel
- Background-aware margin collapse (Layout refinement)
- Sidebar mini mode (collapsed to icons only)
- Nested app shells
- Breadcrumb integration
Internal usage
XDSPage: 8,585 internal usagesXDSPageLayout: 7,374 internal usages- Key patterns: header + sidebar + content (~80%), header-only (~15%), nested layouts (~5%)
- Sidebar width: 260px (~70%), 300px (~15%), custom (~15%)
- Responsive collapse: used in ~60% of cases
Activity
cixzhang commentedon Feb 20, 2026
TBD: We've updated the XDSLayout description to include app shell related work so up for debate whether we need a dedicated component for the shell. It could certainly help with discoverability.
cixzhang commentedon Feb 20, 2026
We don't typically use
XDSAppShell.Headeras a pattern in XDS. More likely to be XDSAppShellHeader. However, I think if we do include AppShell it should more directly compose topnav and left nav in those slots.Some potential value in the shell:
This is starting to look closer to XDSPage.
cixzhang commentedon Feb 20, 2026
We should absolutely leverage ViewTransitions for animations here since animating large areas can introduce performance challenges.
feat(AppShell): add XDSAppShell component
feat(AppShell): add XDSAppShell component