The Sidebar component provides a flexible navigation panel that can slide in from any direction. Built with accessibility and responsive design in mind, it supports fixed and collapsible modes, multiple directions, and customizable content areas. Perfect for navigation menus, filters, settings panels, and any interface requiring additional space.
Basic Usage
Different Directions
Dashboard Users Documents Analytics Notifications Search Settings
Filter Panel
Block Click Outside
Open Sidebar (Click Outside Blocked) Note: This sidebar has `blockClickOutSide=true`, so clicking outside won't close it. You must use the close button.
This sidebar blocks click outside events. You must explicitly close it using the close button or programmatically.
This is useful for modal-like sidebars where you want to ensure the user completes an action before closing.
Close Sidebar
Properties
Property Type Default Description fixedboolean- Whether the sidebar is fixed (always visible) or collapsible. isOpenboolean- Controlled open state of the sidebar. onToggle(open: boolean) => void- Callback fired when the sidebar open state changes. childrenReactNode- Sidebar content. classNamestring- Additional CSS classes for the sidebar. direction'top' | 'bottom' | 'left' | 'right' | 'full''left'Direction from which the sidebar slides in. blockClickOutSidebooleanfalseWhether to prevent closing when clicking outside.
Property Type Description childrenReactNodeHeader content (title, close button, etc.). classNamestringAdditional CSS classes for the header.
SidebarBody
Property Type Description childrenReactNodeMain body content. classNamestringAdditional CSS classes for the body.
Property Type Description childrenReactNodeNavigation content (typically SidebarList). classNamestringAdditional CSS classes for the nav.
Property Type Description childrenReactNodeList items (SidebarListItem components). classNamestringAdditional CSS classes for the list.
Property Type Description childrenReactNodeList item content. classNamestringAdditional CSS classes for the item. onClick() => voidClick handler for the item.
Property Type Description childrenReactNodeFooter content. classNamestringAdditional CSS classes for the footer.
Direction Behavior
Direction Slide Animation Default Size Use Case leftSlides from left edge 288px width Primary navigation, menu rightSlides from right edge 288px width Filters, settings, details topSlides from top edge 288px height Notifications, search bottomSlides from bottom edge 288px height Actions, mobile menus fullSlides from top-left Full screen Modal-like overlays
Accessibility
The Sidebar component includes comprehensive accessibility features:
Keyboard Navigation - Escape key to close, Tab navigation within sidebar
Focus Management - Automatic focus restoration when closed
Screen Reader Support - Proper ARIA attributes and hidden states
Semantic HTML - Uses proper nav, header, and footer elements
Click Outside - Configurable click-outside-to-close behavior
ARIA Labels - Descriptive labels for all interactive elements
Common Use Cases
The Sidebar component is perfect for:
Navigation Menus - Primary and secondary navigation systems
Filter Panels - Advanced filtering and search interfaces
Settings Panels - Application preferences and configuration
User Profiles - Profile information and account management
Shopping Carts - E-commerce cart and checkout flows
Notifications - System notifications and alerts
Help & Support - Documentation and help content
Mobile Menus - Responsive navigation for mobile devices
Best Practices
Appropriate Direction - Choose the direction that makes sense for your layout
Clear Purpose - Use descriptive headers to indicate sidebar purpose
Consistent Behavior - Maintain consistent sidebar behavior across your app
Mobile Optimization - Ensure sidebars work well on mobile devices
Performance - Avoid heavy content that might cause layout shifts
Accessibility - Test with screen readers and keyboard navigation
Visual Hierarchy - Use proper spacing and typography in sidebar content
State Management - Handle sidebar state consistently across components