Sidebar
StableCollapsible multi-level navigation rail and app sidebar supporting icon-only minimized states, neon active borders, notification badges, and glassmorphic panels.
Installation
$pnpm add @siberui/react
Import
tsx
import {
Sidebar,
SidebarHeader,
SidebarContent,
SidebarFooter,
SidebarGroup,
SidebarGroupLabel,
SidebarItem,
SidebarSeparator,
SidebarCollapseButton,
useSidebar
} from '@siberui/react';Basic Usage & Navigation Architecture
The sidebar includes composable headers, scrollable groups, item badges, separators, and collapse triggers that automatically adjust widths and hide labels.
MAIN VIEWPORT CANVAS
tsx
<div className="h-[460px] flex border border-white/[0.06] rounded-xl overflow-hidden shadow-2xl">
<Sidebar>
<SidebarHeader>
<div className="flex items-center gap-2">
<div className="w-8 h-8 rounded-lg bg-white/10 flex items-center justify-center font-bold text-xs text-white">
SU
</div>
<span className="font-bold text-white text-sm">Siber UI</span>
</div>
</SidebarHeader>
<SidebarContent>
<SidebarGroup>
<SidebarGroupLabel>CORE APPLICATION</SidebarGroupLabel>
<SidebarItem icon={<Home className="w-4 h-4" />} label="Dashboard" isActive />
<SidebarItem
icon={<Shield className="w-4 h-4" />}
label="Defense Shield"
badge={<Badge variant="destructive" size="sm">3</Badge>}
/>
<SidebarItem icon={<User className="w-4 h-4" />} label="Personnel" />
</SidebarGroup>
<SidebarSeparator />
<SidebarGroup>
<SidebarGroupLabel>SYSTEM PREFERENCES</SidebarGroupLabel>
<SidebarItem icon={<Settings className="w-4 h-4" />} label="Configurations" />
</SidebarGroup>
</SidebarContent>
<SidebarFooter>
<SidebarCollapseButton className="w-full justify-center mb-2" />
<SidebarItem icon={<LogOut className="w-4 h-4 text-rose-400" />} label="Terminate Session" />
</SidebarFooter>
</Sidebar>
<div className="flex-1 bg-[#050811] p-6 flex flex-col items-center justify-center text-slate-500 font-mono text-xs">
MAIN VIEWPORT CANVAS
</div>
</div>Neon Cybernetic Mission Control Sidebar
Pass variant="neon" to apply cyan laser borders, glowing active tabs with left accent bars, and monospace section labels.
> MISSION TELEMETRY LIVE
ALL SYSTEMS NOMINAL
ALL SYSTEMS NOMINAL
tsx
<div className="h-[460px] flex border border-cyan-500/20 rounded-xl overflow-hidden shadow-[0_0_30px_rgba(0,240,255,0.05)]">
<Sidebar variant="neon" defaultCollapsed>
<SidebarHeader>
<div className="flex items-center justify-center">
<div className="w-8 h-8 rounded-lg bg-cyan-950/80 border border-cyan-400 flex items-center justify-center font-mono text-xs font-bold text-cyan-300 shadow-[0_0_12px_rgba(0,240,255,0.4)]">
SYS
</div>
</div>
</SidebarHeader>
<SidebarContent>
<SidebarGroup>
<SidebarItem icon={<Terminal className="w-4 h-4" />} label="ROUTINES" isActive />
<SidebarItem icon={<Activity className="w-4 h-4" />} label="TELEMETRY" />
<SidebarItem icon={<Cpu className="w-4 h-4" />} label="HARDWARE" />
</SidebarGroup>
</SidebarContent>
<SidebarFooter>
<SidebarCollapseButton className="mx-auto" />
</SidebarFooter>
</Sidebar>
<div className="flex-1 bg-[#03060d] p-6 flex flex-col items-center justify-center font-mono text-cyan-500/60 text-xs text-center">
> MISSION TELEMETRY LIVE<br />ALL SYSTEMS NOMINAL
</div>
</div>API Reference
PROPERTIES (4)← swipe to inspect →
| Property | Description | Type | Default |
|---|---|---|---|
variant | Visual style for Sidebar, Items, and Group labels. | "default" | "neon" | "glass" | "default" |
size | Width scale when expanded and collapsed. | "sm" | "md" | "lg" | "md" |
defaultCollapsed | Initial minimized rail mode state. | boolean | false |
onCollapsedChange | Callback when collapse button is toggled. | (collapsed: boolean) => void | - |
Accessibility
- Landmark & ARIA: Renders inside an HTML5
<aside>element witharia-current="page"on active links.
Best Practices
- Responsive Toggle: Use
SidebarCollapseButtonor hook intouseSidebar()to toggle between expanded labels and compact icon rail views.