Sidebarv2.1.5Documentation Under Review
A collapsible navigation sidebar component with support for headers, menus, submenus, and footers. Built with accessibility and keyboard navigation in mind.
Prefer AI-assisted development?
Catalyst Sidebar is a fully-accessible, collapsible navigation sidebar composed from a set of building-block primitives — SidebarProvider, SidebarRoot, SidebarHeader, SidebarContent, SidebarFooter, and more — giving you a production-ready application shell with keyboard shortcuts, icon-only collapse, and design-token styling out of the box.
Installation
npm install @pmi/catalyst-sidebarimport {
SidebarProvider,
SidebarRoot,
SidebarHeader,
SidebarContent,
SidebarFooter,
SidebarGroup,
SidebarGroupLabel,
SidebarGroupContent,
SidebarMenu,
SidebarMenuItem,
SidebarMenuButton,
SidebarMenuAction,
SidebarMenuBadge,
SidebarMenuSub,
SidebarMenuSubItem,
SidebarMenuSubButton,
SidebarRail,
SidebarTrigger,
} from '@pmi/catalyst-sidebar';Common Patterns
Logo Mark with Text
Use a smaller logo mark alongside a title and subtitle text in the header.
Icon with Text Header
Use any custom icon alongside a title and subtitle text in the header.
Avatar with Text Header
Display a user avatar and name in the header, typically for user-scoped workspaces.
API Reference
Sidebar is a compound component. The sections below document the API surface for each part.
useSidebar
Returns the current sidebar context. Must be called inside a component tree wrapped by SidebarProvider. Throws if called outside of a provider.
const { open, state, setOpen, toggleSidebar } = useSidebar();| Property | Type | Description |
|---|---|---|
open | boolean | Whether the sidebar is currently open |
state | 'expanded' | 'collapsed' | Derived string reflecting open/closed state |
setOpen | (open: boolean) => void | Programmatically set the open state |
toggleSidebar | () => void | Toggle between open and collapsed |
SidebarProvider
Wrapper that provides shared open/collapsed state to all sidebar primitives.
Prop
Type
SidebarRoot
The main sidebar container. Renders an <aside> with collapsible behavior and a keyboard shortcut.
Prop
Type
SidebarHeader
Header section of the sidebar, typically used for branding or user identity.
Prop
Type
SidebarContent
Main content area of the sidebar. Houses navigation groups and menus.
Prop
Type
SidebarFooter
Footer section of the sidebar, typically used for user profiles or quick actions.
SidebarGroup
Groups related menu items together with an optional label and action.
Prop
Type
SidebarGroupLabel
Label heading displayed above a group of menu items.
Prop
Type
SidebarGroupContent
Wrapper for the content within a SidebarGroup.
Prop
Type
SidebarGroupAction
An optional action button displayed alongside a group label.
Prop
Type
SidebarMenu
Container for a list of menu items. Accepts a title prop used as aria-label.
Prop
Type
SidebarMenuItem
Individual menu item. Typically wraps SidebarMenuButton and optional action/badge.
Prop
Type
SidebarMenuButton
The clickable button inside a menu item. Supports asChild for rendering as a Link.
Prop
Type
SidebarMenuAction
An icon-button rendered alongside the menu item, visible on hover.
Prop
Type
SidebarMenuBadge
A numeric or text badge displayed alongside a sub-menu item.
Prop
Type
SidebarMenuSub
Container for a nested list of sub-menu items. Accepts a title prop for aria-label.
Prop
Type
SidebarMenuSubItem
Individual sub-menu item. Wraps SidebarMenuSubButton and optional badge.
Prop
Type
SidebarMenuSubButton
The clickable button inside a sub-menu item. Supports asChild for rendering as a Link.
Prop
Type
SidebarTrigger
A button that toggles the sidebar open or closed from outside the sidebar.
Prop
Type
SidebarRail
A thin interactive rail at the edge of the sidebar that acts as a collapse affordance.
Prop
Type
Accessibility
Sidebar is designed to meet WCAG 2.2 AA standards. The sections below document keyboard behavior and ARIA semantics.
Keyboard Interactions
| Key | Action |
|---|---|
Cmd + B / Ctrl + B | Toggles the sidebar open or collapsed (default hotkey — customisable via hotkey prop) |
ARIA
SidebarRootrenders an<aside>element witharia-label="Sidebar expanded"oraria-label="Sidebar collapsed"to reflect current state. Pass a customaria-labeltoSidebarRootto override the default (e.g.aria-label="Primary navigation"when multiple sidebars are on the page).SidebarTriggerautomatically setsaria-expandedand a state-awarearia-label("Collapse sidebar" / "Expand sidebar"). It also carriesaria-keyshortcuts="Control+b Meta+b"to expose the keyboard shortcut in the AT tree. Override either attribute via props if needed.SidebarMenuandSidebarMenuSubaccept atitleprop that is applied asaria-labelon the underlying<ul>. Always passtitleto label navigation regions for screen-reader landmark navigation.- Expandable menu items (disclosure pattern) must carry
aria-expandedto announce open/closed state to assistive technology.data-openis a CSS styling hook used by Tailwind selectors (group-data-[open=true]/menu-button) and carries no ARIA semantics. Do not addaria-haspopup— it implies an ARIAmenuwidget with arrow-key navigation, whichSidebarMenuSubis not. Optionally addaria-controls="<submenu-id>"when the submenu element has a stable, persistent ID. SidebarMenuActiondefaults toaria-label="More actions". Always override with a specific label describing the action in context (e.g.aria-label="More actions for Routing").SidebarGroupLabelmust useasChildwith a semantic heading element (e.g.<h5>) to preserve heading structure for screen-reader navigation.SidebarMenuBadgenumeric content (e.g."7") is announced without context. Include the count in the accessible name of the adjacent menu item — for example,aria-label="General, 7 unread"on theSidebarMenuSubButtonor link.- Avatar images used purely as decorative marks or brand icons should use
aria-hidden. User-identity avatars (e.g. a profile photo inSidebarFooter) are meaningful and must carry descriptivealttext (e.g.alt="Sophie Richardson") so screen readers can announce whose account is represented. - Catalyst provides the visual styling; consumers are responsible for meaningful link text, button labels, and ARIA attributes.
See WCAG 2.2 SC 2.1.1 Keyboard and SC 4.1.2 Name, Role, Value for the relevant success criteria.
Choosing the Right Component
Use Sidebar when you need persistent, collapsible application navigation on the side of the viewport. Reach for a different primitive when:
| If you need… | Use instead |
|---|---|
| A horizontal top-level navigation bar | NavigationMenu |
| A slide-over overlay panel (e.g. mobile nav) | Sheet |
| A dropdown list of links from a trigger | DropdownMenu |
| A set of content tabs within a page | Tabs |
Related
Pagination
A navigation component for traversing paged content. Built on Radix UI Slot with CVA variants, accessible ARIA semantics, and full asChild polymorphic composition.
Tabs
Tab navigation for organizing related content into distinct views with accessible keyboard navigation and state management. Built on Radix UI Tabs.