Sidebar

Composable navigation sidebar for application layouts

import {SidebarProvider,SidebarLayout,Sidebar,SidebarHeader,SidebarContent,SidebarFooter,SidebarGroup,SidebarGroupLabel,SidebarMenu,SidebarMenuItem,SidebarMenuButton,SidebarInset,SidebarTrigger,} from "@plexui/ui/components/Sidebar";

Examples

Overview

Scrollable Content

Text-Only Navigation

Collapse Modes

Nested Navigation

Mobile Menu

Skeleton

Group Label Sizes

size

Badges

Reference

Structure

A Sidebar is composed of the following parts:

  • SidebarProvider – Handles collapsible state and provides context to all child components.
  • SidebarLayout – Wrapper for sidebar and main content.
  • Sidebar – The sidebar container.
  • SidebarHeader / SidebarFooter – Sticky at the top and bottom of the sidebar.
  • SidebarContent – Scrollable content area.
  • SidebarGroup – Section within the content, with optional label.
  • SidebarMenu / SidebarMenuItem / SidebarMenuButton – Navigation menu items.
  • SidebarMenuSub / SidebarMenuSubButton – Nested submenu items.
  • SidebarInset – Main content area next to the sidebar.
  • SidebarTrigger – Toggle button for collapsing the sidebar.

Use Cmd+B (Mac) or Ctrl+B (Windows/Linux) to toggle the sidebar with keyboard.

SidebarProvider

Handles sidebar state and provides context to all child components. Wrap your application layout in this provider.

PropTypeDefaultDescription
collapsible"offcanvas" | "icon" | "none""offcanvas"Collapse behavior: offcanvas (drawer on mobile, full collapse on desktop), icon (icon rail), or none
defaultOpenbooleantrueInitial open state (uncontrolled)
openbooleanControlled open state
onOpenChange(open: boolean) => voidCalled when open state changes

The main sidebar container. Renders as an <aside> element.

PropTypeDefaultDescription
variant"sidebar" | "docs""sidebar"Visual variant
side"left" | "right""left"Which side the sidebar is on

SidebarMenuButton

Renders a menu item button. Use isActive to highlight the current page.

PropTypeDefaultDescription
isActivebooleanfalseHighlight the current page
tooltipstring | ReactNodeLabel shown on hover when collapsed (icon mode). Hidden on mobile.

SidebarGroupLabel

Renders a section label within a SidebarGroup. Supports two size variants.

PropTypeDefaultDescription
size"sm" | "lg""lg"sm — compact, tertiary; lg — larger, primary, more spacing

SidebarMenuSub

Renders a collapsible submenu container for nested navigation.

PropTypeDefaultDescription
openbooleantrueWhether submenu is expanded
hasIconsbooleanfalseAlign child items with parent text that has icons

SidebarCard

Renders a promotional card in the sidebar footer for CTAs, upgrades, or announcements.

PropTypeDefaultDescription
dismissiblebooleanShows dismiss button
onDismiss() => voidCallback when dismissed

useSidebar

Hook to access sidebar state and controls from any component within SidebarProvider.

  • state – Current state: "expanded" or "collapsed"
  • open / setOpen – Desktop sidebar open state
  • openMobile / setOpenMobile – Mobile menu open state
  • isMobile – Whether the viewport is mobile
  • collapsible – Current collapsible mode
  • toggleSidebar – Toggle function for both desktop and mobile