Sidebar
A collapsible side navigation panel component.
Usage
The Sidebar component provides a collapsible navigation panel with header, main content, groups, and footer sections.
Sidebar Props
Prop | Type | Default |
---|---|---|
open | boolean | - |
onOpenChange | (open: boolean) => void | - |
position | "left" | "right" | "left" |
profile | { icon?: ReactNode; label?: string | undefined; href?: string | undefined; onIconClick?: (() => void) | undefined; } | - |
Sidebar.Header Props
Prop | Type | Default |
---|---|---|
logo | ReactNode | - |
title | string | - |
onLogoClick | () => void | - |
Sidebar.Group Props
Prop | Type | Default |
---|---|---|
name | string | - |
icon | ReactNode | - |
children | ReactNode | - |
Sidebar.Item Props
Prop | Type | Default |
---|---|---|
icon | ReactNode | - |
href | string | - |
active | boolean | - |
disabled | boolean | - |
children | ReactNode | - |
Examples
Position
The Sidebar can be positioned on either the left or right side of the screen.
State
The Sidebar supports expanded and collapsed states with smooth transitions.
Accessibility
The Sidebar implements the following accessibility features:
-
Proper ARIA roles and attributes
role="navigation"
for the main sidebarrole="banner"
for the headerrole="menuitem"
for navigation itemsaria-expanded
to indicate sidebar statearia-current="page"
for active itemsaria-disabled="true"
for disabled items
-
Keyboard navigation support
- Enter/Space to toggle sidebar expansion
- Tab navigation through interactive elements
-
Screen reader support
- Meaningful labels for all interactive elements
- Hidden decorative elements
- Clear state indicators