Component

Sidebar

A vertical navigation panel with sections, items, and active state. Supports collapsed mode and role-based visibility. Uses the headless @refraction-ui/sidebar core.

Examples

Sidebar with grouped sections and active item highlighting.

Installation

$pnpm add @refraction-ui/react-sidebar

Usage

tsx
import { Sidebar } from '@refraction-ui/react-sidebar'

export function MyComponent() {
  return (
    <Sidebar
      sections={[
        {
          title: 'Navigation',
          items: [
            { label: 'Dashboard', href: '/dashboard' },
            { label: 'Settings', href: '/settings' },
          ],
        },
      ]}
      currentPath="/dashboard"
    />
  )
}

Props

PropTypeDefaultDescription
sectionsSidebarSection[]--Array of sections with title and items.
currentPathstring--Current pathname for active item highlighting.
collapsedbooleanfalseWhether the sidebar is collapsed.
userRolesstring[]--User roles for visibility-based filtering.
classNamestring--Additional CSS classes.