Sidebar
Collapsible vertical navigation drawer/sidebar.
Main
Contract
Section titled “Contract”Overview
Machine-readable contract from Component Spec.
component: sidebarexport: Sidebarversion: 1attributes: data-refineui=sidebar
Anatomy
| Part | data-refineui |
|---|---|
| root | sidebar |
| brand | sidebar-brand |
| content | sidebar-content |
| footer | sidebar-footer |
| group | sidebar-group |
| group_label | sidebar-group-label |
| header | sidebar-header |
| link | sidebar-link |
| nav | sidebar-nav |
| peek | sidebar-peek |
| peek_edge | sidebar-peek-edge |
| peek_inset | sidebar-peek-inset |
| peek_panel | sidebar-peek-panel |
| peek_pin | sidebar-peek-pin |
| peek_surface | sidebar-peek-surface |
States
| Scope | Category | Values |
|---|---|---|
| component | pseudo | focus-visible |
| component | environment | forced-colors, dir |
Focus
| Section | Property | Value |
|---|---|---|
| visual | required | true |
| visual | selector | :focus-visible |
Layout
| Property | Value |
|---|---|
| direction | logical |
| rtl | true |
Installation
Section titled “Installation”npm install @refineui/react @refineui/tokensyarn add @refineui/react @refineui/tokenspnpm add @refineui/react @refineui/tokensbun add @refineui/react @refineui/tokensimport { Sidebar, SidebarHeader, SidebarBrand, SidebarContent, SidebarNav, SidebarGroup, SidebarGroupLabel, SidebarLink, SidebarFooter} from "@refineui/react";
<Sidebar> <SidebarHeader> <SidebarBrand> <Logo /> My App </SidebarBrand> </SidebarHeader> <SidebarContent> <SidebarNav> <SidebarGroup> <SidebarGroupLabel>Main</SidebarGroupLabel> <SidebarLink href="/" active>Dashboard</SidebarLink> <SidebarLink href="/projects">Projects</SidebarLink> <SidebarLink href="/tasks">Tasks</SidebarLink> </SidebarGroup> <SidebarGroup> <SidebarGroupLabel>Settings</SidebarGroupLabel> <SidebarLink href="/settings">Preferences</SidebarLink> <SidebarLink href="/profile">Profile</SidebarLink> </SidebarGroup> </SidebarNav> </SidebarContent> <SidebarFooter> <p>© 2024</p> </SidebarFooter></Sidebar>API Reference
Section titled “API Reference”Sidebar
Section titled “Sidebar”Root sidebar container (<aside> element).
SidebarHeader
Section titled “SidebarHeader”Header section.
SidebarBrand
Section titled “SidebarBrand”Brand/logo area.
SidebarContent
Section titled “SidebarContent”Main content area.
SidebarNav
Section titled “SidebarNav”Navigation container (<nav> element).
SidebarGroup
Section titled “SidebarGroup”Groups related links.
SidebarGroupLabel
Section titled “SidebarGroupLabel”Label for a group.
SidebarLink
Section titled “SidebarLink”| Prop | Default | Type | Description |
|---|---|---|---|
| active | false | boolean | Marks the current page (`aria-current="page"`). |
SidebarFooter
Section titled “SidebarFooter”Footer section.
Sidebar peek (collapsed hover)
Section titled “Sidebar peek (collapsed hover)”Composable flyout when the docked sidebar is collapsed — edge hover reveals a floating panel over the main area (content does not reflow).
<SidebarPeek enabled={collapsed} widthPercent={28} mode="contained" onPin={expand}> <SidebarPeekEdge /> <SidebarPeekPanel> <SidebarPeekPin>{/* pin control */}</SidebarPeekPin> <Sidebar>...</Sidebar> </SidebarPeekPanel> <SidebarPeekInset>{/* main + toggle */}</SidebarPeekInset></SidebarPeek>Use mode="viewport" with --refineui-sidebar-peek-viewport-offset when the peek layer should align below a fixed app header.