Skip to main content

Overview

The Sidebar component provides a vertical navigation panel that can be collapsed and expanded. It supports hierarchical navigation with groups, icons, and tooltips, making it ideal for complex application layouts.

Use cases

  • Display hierarchical application navigation
  • Organize navigation items into logical groups
  • Save screen space with collapsible functionality
  • Provide contextual tooltips when collapsed
  • Build dashboard and admin panel layouts
  • Create file explorer or resource browser interfaces

Anatomy

The Sidebar component consists of:
  • Sidebar - Root container with collapse functionality
  • Sidebar.Header - Top section for branding or user info
  • Sidebar.Main - Primary navigation area
  • Sidebar.Footer - Bottom section for settings or actions
  • Sidebar.Group - Navigation group with label
  • Sidebar.Item - Individual navigation link

Props

'left' | 'right'
default:"'left'"
Position of the sidebar on the screen.
boolean
default:"false"
When true, tooltips will not be shown for navigation items when the sidebar is collapsed.
boolean
default:"true"
When false, disables the collapse/expand functionality.
ReactNode
Custom tooltip message for the collapse/expand handle. Defaults to “Click to collapse” or “Click to expand”.
boolean
Controlled open state of the sidebar. Use with onOpenChange for controlled behavior.
boolean
default:"true"
Default open state for uncontrolled usage.
(open: boolean) => void
Callback fired when the sidebar open state changes.
string
Additional CSS class names to apply to the sidebar.
string
Additional CSS class names to apply to the header section.
string
Additional CSS class names to apply to the main navigation section.
string
Additional CSS class names to apply to the footer section.
string
required
The label text for the navigation group.
ReactNode
Icon to display before the group label.
object
Object containing className overrides for different parts:
  • header - Group header container
  • items - Group items container
  • label - Label text
  • icon - Leading icon
string
Additional CSS class names to apply to the group.
ReactNode
Icon to display before the item label. When collapsed and no icon is provided, an avatar with the first letter will be shown.
boolean
default:"false"
Indicates whether this item is currently active/selected.
boolean
default:"false"
When true, the item is disabled and cannot be interacted with.
ReactElement
Custom element to render instead of the default anchor tag. Useful for integration with routing libraries.
object
Object containing className overrides for different parts:
  • root - Item container
  • leadingIcon - Icon container
  • text - Label text
string
Additional CSS class names to apply to the item (legacy, use classNames.root instead).

Usage

Basic sidebar

With navigation groups

Controlled sidebar

With active state

Right-positioned sidebar

Non-collapsible sidebar

With disabled items

Accessibility

  • Uses semantic <aside> element with role="navigation" attribute
  • Includes aria-label="Navigation Sidebar" for screen readers
  • Collapse/expand handle is keyboard accessible with Enter and Space keys
  • Each item has role="menuitem" for proper navigation semantics
  • Active items use aria-current="page" attribute
  • Disabled items use aria-disabled attribute
  • Collapsed state is communicated via aria-expanded attribute
  • Navigation groups have proper aria-label attributes
  • Tooltips provide context when sidebar is collapsed

Styling customization

Customize the sidebar using className props:
The component exposes data attributes for state-based styling: