Axon 911 Frontend DocsAxon 911 Frontend Docs
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.
Sidebar
NameTypeDefaultDescription
aria-labelLocalizedMessage—Accessible name of the nav landmark. Required, because an application often has more than one navigation landmark.
childrenReactNode—Header, content, footer, and the rows they hold.
classNamestring—Classes appended to the nav. Put overrides in @layer chroma.overrides.
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
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
Sidebar
Storybook
Collapsed state
Import
Default
With nested groups
Icon collapsed
With footer
Nested group toggle