Repository navigation
Description
Spec (revised 2026-02-21)
Sidebar navigation component for application pages. Supports collapsible sections, nested items, selected state, icons, and responsive collapse.
Internal usage
- XDSPageNav: 26 usages (container — low because apps have one)
- XDSPageNavItem: 12,885 usages
- XDSPageNavSection: 2,327 usages
- XDSPageNavCollapsibleItem: 1,054 usages
- internal component: 4,921 usages (composes PageNav with built-in common data across tools)
External comparison
| System | Component | Approach |
|---|---|---|
| Mantine | AppShell.Navbar + NavLink |
NavLink has label, icon, active, children (nesting), opened |
| Ant Design | Menu (mode="inline") |
Data-driven items array, selectedKeys, openKeys |
| MUI | Drawer + List/ListItemButton |
Composition with List components, manual nesting |
| shadcn/ui | Sidebar (new) |
SidebarMenu, SidebarMenuItem, SidebarMenuButton |
Mantine's NavLink is closest to internal XDSPageNavItem — single component with icon, label, active state, nesting.
Key decisions
| Decision | Choice | Rationale |
|---|---|---|
| Composition over config | Children-based | Matches XDS convention, flexible |
collapsible prop |
Uses useXDSCollapsible (#187) |
Consistent primitive pattern |
isSelected not isActive |
More specific | Matches internal API |
isSelected management |
Manual in core, router helpers in framework packages | Framework-agnostic core |
| Router integration | useXDSNavItemProps hook in @xds/next (packages/integrations/next/) |
Spread helper pattern: {...useXDSNavItemProps({ href, match })}. Supports exact, prefix, and custom matching. |
| CommonPageNav equivalent | None — app-level concern | Internal CommonPageNav bakes in Meta-specific common nav items |
| Separate from AppShell | PageNav = content, AppShell = layout | Clean separation. AppShell owns positioning, sticky, scroll. |
No isFixedPosition |
AppShell controls positioning | PageNav doesn't own layout |
| Collapsed nav (icon-only) | Deferred to v2 | Complex — needs icon-only nav items. AppShell owns sidebar visibility. |
| Naming convention | Flat (XDSPageNavItem) not compound (XDSPageNav.Item) |
Consistent with XDS conventions |
Visual structure
Five zones stacked vertically:
┌─────────────────────┐
│ Header (sticky) │ ← slot: header (product icon/name, suite/account context)
├─────────────────────┤
│ Action area (sticky)│ ← slot: stickyContent (create button, pinned items)
├─────────────────────┤
│ │
│ Nav sections │ ← children (scrollable)
│ │
├─────────────────────┤
│ Footer │ ← slot: footer (promo cards, etc.)
├─────────────────────┤
│ Footer icons │ ← slot: footerIcons (icon buttons / menus)
└─────────────────────┘
Proposed API
interface XDSPageNavProps {
/** Header area — typically XDSPageNavHeader. Sticky at top. */
header?: ReactNode;
/** Content pinned below header (e.g., create button, top-level items). Sticky. */
stickyContent?: ReactNode;
/** Navigation sections and items. Scrollable. */
children: ReactNode;
/** Footer area above icon bar (e.g., promo cards) */
footer?: ReactNode;
/** Footer icon bar (e.g., back, help, notifications, avatar) */
footerIcons?: ReactNode;
/** StyleX overrides */
xstyle?: StyleXStyles;
"data-testid"?: string;
}
interface XDSPageNavHeaderProps {
/** Product/app icon */
icon?: ReactNode;
/** Product/app name */
title: string;
/** Link for the title (e.g., product home) */
titleHref?: string;
/** Text above the title (e.g., suite name) */
supertitle?: string;
/** Link for the supertitle (e.g., suite home) */
supertitleHref?: string;
/** Text below the title (e.g., account context) */
subtitle?: string;
/** Link for the subtitle */
subtitleHref?: string;
/** Show dropdown chevron indicator */
hasChevron?: boolean;
/**
* Menu content shown in a popover. When provided, the header composes
* XDSPopover internally (lazy loaded). The trigger boundary is determined
* automatically:
* - No hrefs → whole header is the trigger
* - With hrefs → links are independent, chevron/remaining area is the trigger
* Popover minWidth defaults to the header's width (matching sidebar context).
* Menu content can set its own width to go wider (e.g., mega menus).
*/
menu?: ReactNode;
/** StyleX overrides */
xstyle?: StyleXStyles;
"data-testid"?: string;
}
interface XDSPageNavItemProps {
/** Item label */
label: string;
/** Icon (outline) */
icon?: XDSIconType;
/** Icon when selected (filled) */
selectedIcon?: XDSIconType;
/** Current page indicator */
isSelected?: boolean;
isDisabled?: boolean;
/** Navigation URL */
href?: string;
onClick?: (e: React.MouseEvent) => void;
/** Right-side content (badges, counts) */
endContent?: ReactNode;
/** Sub-items for nesting */
children?: ReactNode;
/** Collapsible config from useXDSCollapsible (#187) */
collapsible?: XDSCollapsibleConfig;
"data-testid"?: string;
}
interface XDSPageNavSectionProps {
title: string;
subtitle?: string;
children: ReactNode;
collapsible?: XDSCollapsibleConfig;
endContent?: ReactNode;
isHeaderHidden?: boolean;
"data-testid"?: string;
}Usage
// Single product — title links home
<XDSPageNav
header={<XDSPageNavHeader icon={<AppIcon />} title="My App" titleHref="/" />}
stickyContent={<XDSButton label="Create new" variant="primary" />}
footerIcons={<>
<XDSButton icon={HelpIcon} />
<XDSButton icon={BellIcon} />
</>}
>
<XDSPageNavSection title="Main">
<XDSPageNavItem
label="Dashboard"
icon={HomeIcon}
selectedIcon={HomeIconSolid}
isSelected={page === "dashboard"}
href="/dashboard"
/>
<XDSPageNavItem
label="Projects"
icon={FolderIcon}
href="/projects"
endContent={<XDSBadge label="3" />}
/>
</XDSPageNavSection>
<XDSPageNavSection title="Settings" collapsible={useXDSCollapsible()}>
<XDSPageNavItem label="General" href="/settings/general" />
<XDSPageNavItem label="Security" href="/settings/security" />
</XDSPageNavSection>
</XDSPageNav>
// Suite — supertitle + title with independent links, menu on chevron
<XDSPageNav
header={
<XDSPageNavHeader
icon={<SuiteIcon />}
supertitle="Suite Name"
supertitleHref="/suite"
title="Product Name"
titleHref="/product"
menu={<ProductSwitcher />}
/>
}
>
{/* ... */}
</XDSPageNav>
// Account context — subtitle below title, whole header triggers menu
<XDSPageNav
header={
<XDSPageNavHeader
icon={<AppIcon />}
title="Product Name"
subtitle="Business Account"
menu={<AccountSwitcher />}
/>
}
>
{/* ... */}
</XDSPageNav>
// With AppShell
<XDSAppShell
topNav={<XDSTopNav title="My App" />}
pageNav={
<XDSPageNav header={<XDSPageNavHeader ... />}>
{/* ... */}
</XDSPageNav>
}
>
{content}
</XDSAppShell>Header interaction model
XDSPageNavHeader composes XDSPopover internally (lazy loaded) when menu is provided. The trigger boundary is determined automatically based on which hrefs are present:
| Props provided | Behavior |
|---|---|
titleHref only, no menu |
Whole header is one link |
titleHref + supertitleHref, no menu |
Each text is an independent link |
menu only, no hrefs |
Whole header is the popover trigger |
menu + hrefs |
Links are independent <a> elements, chevron/remaining area is the popover trigger |
Popover sizing: minWidth defaults to the header's measured width (matching the sidebar context). Menu content can set its own width to go wider — mega menus typically extend beyond the sidebar into the content area.
hasChevron: Automatically shown when menu is provided. Can be set explicitly for cases where the trigger is managed externally.
Icon: Follows the title link when titleHref is provided. Static otherwise.
Router integration (separate package)
Framework-agnostic core with router helpers in packages/integrations/next/:
// @xds/next — useXDSNavItemProps hook
import { useXDSNavItemProps } from "@xds/next";
// Exact match (default)
<XDSPageNavItem label="Dashboard" {...useXDSNavItemProps({ href: "/dashboard" })} />
// Prefix match — stays selected on /settings/*
<XDSPageNavItem label="Settings" {...useXDSNavItemProps({ href: "/settings", match: "prefix" })} />
// Custom matcher
<XDSPageNavItem label="Admin" {...useXDSNavItemProps({ href: "/admin", match: (path) => path.startsWith("/admin") })} />Returns { href, isSelected, onClick } — reads current route, sets isSelected based on path matching, wires up client-side navigation.
Selected state visual treatment
- Light accent background fill, full-width rounded pill shape
- Icon + label
aria-current="page"for accessibility
Accessibility
<nav aria-label="Page navigation">aria-current="page"on selected item- Sections:
role="group"witharia-labelledby - Collapsible:
aria-expandedon trigger - Keyboard: Tab through items, Enter/Space to activate
v1 scope
Include:
XDSPageNavcontainer withheader,stickyContent,footer,footerIconsslots + childrenXDSPageNavHeader— composition for header area (single product, suite, account context variants)XDSPageNavItem— icon, selectedIcon, label, isSelected, href, onClick, endContent, nesting, collapsibleXDSPageNavSection— title, collapsible, children
Defer:
- Nested nav variant (back button + breadcrumb pattern)
- Footer icons (need menus, icon-only button pattern settled)
- Promo card pattern
@xds/nextrouter integration package- Collapsed nav / icon-only sidebar
- Expand-on-hover
- Animation
- Mobile responsive (AppShell handles)
Depends on
- useXDSCollapsible hook + collapsible prop pattern #187 useXDSCollapsible
- XDSAppShell #185 XDSAppShell (for positioning/layout context)
Activity
[-]Page Nav[/-][+]XDSPageNav (sidebar navigation)[/+]cixzhang commentedon Feb 20, 2026
For true internal usage we need to check internal component because this composes with built-in common data across tools. That usage is 4921 which is substantial.
rubyycheung commentedon Feb 20, 2026
Some design inspiration based on some common tool management apps https://www.figma.com/design/FYcyIstZy1Yq5P09lHZhd0/XDS-Component-Lab?node-id=755-16124&t=aIzC0kCjyUwkd0td-1
feat(PageNav): add XDSPageNav component with header, items, and sections
feat(PageNav): add XDSPageNav component with header, items, and sections
fix(PageNav): address review feedback
feat(PageNav): add XDSPageNav component with header, items, and secti…
cixzhang commentedon Feb 22, 2026
Landed in PR #251 (XDSPageNav with header, items, and sections).
feat(PageNav): add XDSPageNav component with header, items, and secti…
feat(PageNav): add XDSPageNav component with header, items, and secti…