Axon 911 Frontend Docs
    Loading navigation…
U
User
Switch to light mode
  1. Components
  2. Sidebar
  3. API and Development

Sidebar

API and Development

View SourceOpens in a new tabSubmit IssueOpens in a new tab
Sidebar from @prepared911/ui/sidebar is a nav landmark. Pass a required aria-label. collapsed, defaultCollapsed, and onCollapsedChange live on Sidebar; there is no provider. Compose with SidebarHeader, SidebarContent, SidebarFooter, SidebarSection (label is the section heading), SidebarItem, SidebarGroup, SidebarNestedGroup, SidebarExpandableItem, and SidebarSeparator. Row icons are glyphs (icon), and active marks the current page.
Child order
Direct Sidebar children must appear in document order so visual layout matches keyboard and screen-reader order:
  1. SidebarSearch (optional; settings-style sidebars)
  2. SidebarHeader (optional)
  3. SidebarContent (required)
  4. SidebarFooter (optional)
Put SidebarSection, groups, and rows inside SidebarContent or SidebarFooter. A wrong order logs a one-time dev warning in non-production builds.
Sidebar
NameTypeDefaultDescription
aria-labelLocalizedMessage—Accessible name of the nav landmark. Required, because an application often has more than one navigation landmark.
childrenReactNode—Direct children in document order: {@link SidebarSearch } (optional), {@link SidebarHeader } (optional), {@link SidebarContent }, {@link SidebarFooter } (optional). Sections and rows live inside content or footer.
classNamestring—@deprecated Pass layout through enum props and shipped parts. Request a missing case via find-pattern.
collapsedboolean—Controlled icon-only state.
defaultCollapsedbooleanfalseInitial icon-only state when uncontrolled.
onCollapsedChangeSidebarCollapsedChangeHandler—Fires when the collapsed state is asked to change, from {@link useSidebar } or from a collapsed {@link SidebarGroup }.
refRef<HTMLElement>—Ref to the nav.
Storybook
Interactive examples and edge cases for this component are in Storybook.
DefaultOpens in a new tab
Figma
The Sidebar Search component set on the Sidebar page of the Axon 911 Design System file maps to SidebarSearch through packages/ui/src/components/sidebar/sidebar-search.figma.ts, and the Sidebar set's header slot uses it. Placeholder and Value are the visible copy, Filled shows the clear button, and Focus draws the focus ring for stories only. The clear button name, the empty-results copy and the accessible name are code-only. See Figma Code Connect.
Collapsed state
defaultCollapsed starts the rail when uncontrolled. collapsed controls it. onCollapsedChange(collapsed, details) reports a request to change. useSidebar reads the nearest sidebar. The component does not render a collapse control; the owner places one outside the nav.
Import
Default
With nested groups
Icon collapsed
With footer
Nested group toggle
Previous
Sidebar / Usage
Next
Sidebar / Accessibility
On this page
Child order
Sidebar
Storybook
Figma
Collapsed state
Import
Default
With nested groups
Icon collapsed
With footer
Nested group toggle