Sidebar Component

Sidebar renders a collapsible navigation panel with support for responsive layouts and custom content.

Usage

To import and use the Sidebar component in your application, use the following code snippet:

Demos

Explore the demos of the React Sidebar component. Refer to this page.

Props

The following table outlines the props for the Sidebar component:

NameTypeDefaultDescription
backdrop
boolean
false

Specifies whether to render a backdrop overlay when the sidebar is open.

closeOnDocumentClick
boolean
true

Specifies whether clicking outside closes the sidebar.

defaultOpen
boolean
false

Specifies the initial visibility of the Sidebar in uncontrolled mode.

dockable
boolean
false

Specifies whether the sidebar can collapse into a compact docked state while remaining visible.

dockableWidth
string
'48px'

Specifies the width of the sidebar when dockable mode is enabled and the sidebar is in its docked state.

mediaQuery
string
-

Specifies the media query used to automatically control the sidebar's responsive open and closed state.

mode
'Push'

Specifies how the Sidebar interacts with the surrounding content.

open
boolean
-

Specifies the controlled visibility.

position
'Left'

Specifies the edge the Sidebar anchors to.

transition
{ enter: 300, exit: 300 }

Specifies the duration of the sidebar transition animation in milliseconds.

Events

The following table outlines the events for the Sidebar component:

NameTypeDescription
onOpenChange
(event: SidebarChangeEvent) => void

Specifies the callback triggered when the sidebar's open state changes.