# Sidebar
**Category**: react
**URL**: https://ui.darkcode.dev/en/docs/react/components/sidebar
**Source**: https://raw.githubusercontent.com/DarkCode-Developers/darkcode-ui/refs/heads/main/apps/docs/content/docs/en/react/components/(navigation)/sidebar.mdx
> A responsive sidebar navigation component with collapsible groups, rail mode, icon collapse, resizing, hover-to-peek, search, drag-to-reorder, and mobile sheet support.
***
## Import
```tsx
import { Sidebar, useSidebar } from '@darkcode-ui/react';
```
### Usage
```tsx
"use client";
import {Sidebar} from "@darkcode-ui/react";
import {ChartColumn, Folder, Gear, House, ListUl, Persons, Sparkles} from "@gravity-ui/icons";
export function SidebarDefault() {
return (
DarkCode
DashboardProjectsTasks8TeamAnalyticsSettings
Dashboard
);
}
```
### Anatomy
Import the Sidebar component and access all parts using dot notation.
```tsx
import { Sidebar } from '@darkcode-ui/react';
export default () => (
);
```
The menu is built on the React Aria [Tree](https://react-spectrum.adobe.com/react-aria/Tree.html) collection, so it ships full keyboard navigation, typeahead, and nested expand/collapse out of the box. `` is responsive: on desktop it renders a fixed panel, and at mobile widths (≤768px) it automatically renders its children inside a slide-in [Drawer](/en/react/components/drawer).
### Complex
A full-featured sidebar with teamspaces, favorites, nested menus, and a user footer.
```tsx
"use client";
import {Sidebar} from "@darkcode-ui/react";
import {Bell, Code, House, Magnifier, Palette, Star} from "@gravity-ui/icons";
import {Brand, DemoMain, NavItem, UserFooter} from "./shared";
export function SidebarComplex() {
return (
} label="Home" />
} label="Search" />
} label="Inbox" />
TeamspacesEngineeringDesignFavorites} label="Q3 Planning" />
} label="Release Notes" />
);
}
```
### Compact With User Menu
Compact sidebar with a user button at the footer.
```tsx
"use client";
import {Button, Sidebar} from "@darkcode-ui/react";
import {Folder, Gear, House, Persons} from "@gravity-ui/icons";
import {Brand, DemoMain, NavItem, UserFooter} from "./shared";
export function SidebarCompactWithUserMenu() {
return (
} label="Overview" />
} label="Documents" />
} label="Members" />
} label="Settings" />
);
}
```
### Meeting Notes
Notes-style sidebar with a search field and spaces. Uses `collapsible="offcanvas"`.
```tsx
"use client";
import {Button, Sidebar} from "@darkcode-ui/react";
import {Calendar, FileText, Magnifier, Person} from "@gravity-ui/icons";
import {Brand, DemoMain, NavItem, UserFooter} from "./shared";
export function SidebarMeetingNotes() {
return (
Spaces} label="All Notes" />
} label="Meetings" />
} label="1:1s" />
);
}
```
### Agent Hub
Agent-focused sidebar combining workspaces, recent chats, and a user footer.
```tsx
"use client";
import {Sidebar} from "@darkcode-ui/react";
import {Comment, Sparkles, Wrench} from "@gravity-ui/icons";
import {Brand, DemoMain, NavItem, UserFooter} from "./shared";
export function SidebarAgentHub() {
return (
} label="Agents" />
} label="Conversations" />
} label="Tools" />
Recent chats} label="Refactor billing module" />
} label="Generate release notes" />
} label="Triage open issues" />
);
}
```
### Agent Workspace
Workspace sidebar with agent tasks grouped by status, inspired by AI coding tools.
```tsx
"use client";
import {Sidebar} from "@darkcode-ui/react";
import {CircleCheck, CircleDashed, Code} from "@gravity-ui/icons";
import {Brand, DemoMain, NavItem, UserFooter} from "./shared";
export function SidebarAgentWorkspace() {
return (
darkcode-uiIn progress2} label="Add Sidebar component" />
} label="Fix tree navigation" />
Done5} label="Bundle size budget" />
);
}
```
### Inset Variant
The inset variant uses a transparent sidebar background with a card-like content area.
```tsx
"use client";
import {Sidebar} from "@darkcode-ui/react";
import {Folder, Gear, House, Persons} from "@gravity-ui/icons";
import {Brand, DemoMain, NavItem, UserFooter} from "./shared";
export function SidebarInsetVariant() {
return (
} label="Dashboard" />
} label="Projects" />
} label="Team" />
} label="Settings" />
);
}
```
### With Groups
Organize menu items into labeled groups separated by dividers.
```tsx
"use client";
import {Sidebar} from "@darkcode-ui/react";
import {CreditCard, Folder, Gear, House, Person} from "@gravity-ui/icons";
import {Brand, DemoMain, NavItem} from "./shared";
export function SidebarWithGroups() {
return (
Platform} label="Dashboard" />
} label="Projects" />
Account} label="Profile" />
} label="Billing" />
} label="Settings" />
);
}
```
### Collapsible Groups
Use expandable groups for documentation-style navigation with guide lines.
```tsx
"use client";
import {Sidebar} from "@darkcode-ui/react";
import {Brand, DemoMain, NavItem} from "./shared";
export function SidebarCollapsibleGroups() {
return (
Getting StartedComponents
);
}
```
### Collapsible
Enable `collapsible="icon"` to allow the sidebar to collapse into an icon-only rail. Press `Cmd+B` / `Ctrl+B` to toggle.
```tsx
"use client";
import {Sidebar} from "@darkcode-ui/react";
import {Folder, Gear, House, Persons} from "@gravity-ui/icons";
import {Brand, DemoMain, NavItem} from "./shared";
export function SidebarCollapsible() {
return (
} label="Dashboard" />
} label="Projects" />
} label="Team" />
} label="Settings" />
);
}
```
### Reduced Motion
Pass `reduceMotion` to `Sidebar.Provider` to disable expand/collapse animations.
```tsx
"use client";
import {Sidebar} from "@darkcode-ui/react";
import {Folder, House, Square} from "@gravity-ui/icons";
import {Brand, DemoMain, NavItem} from "./shared";
export function SidebarReducedMotion() {
return (
} label="Dashboard" />
Projects} label="Project A" />
} label="Project B" />
);
}
```
### Floating Variant
The floating variant renders the sidebar with rounded corners and a shadow.
```tsx
"use client";
import {Sidebar} from "@darkcode-ui/react";
import {Folder, Gear, House, Persons} from "@gravity-ui/icons";
import {Brand, DemoMain, NavItem, UserFooter} from "./shared";
export function SidebarFloatingVariant() {
return (
} label="Dashboard" />
} label="Projects" />
} label="Team" />
} label="Settings" />
);
}
```
### With Avatar
Display an organization avatar in the sidebar header.
```tsx
"use client";
import {Avatar, Sidebar} from "@darkcode-ui/react";
import {Folder, House, Persons} from "@gravity-ui/icons";
import {DemoMain, NavItem, UserFooter} from "./shared";
export function SidebarWithAvatar() {
return (
AC
Acme CorpPro plan
} label="Dashboard" />
} label="Projects" />
} label="Team" />
);
}
```
### Right Side
Position the sidebar on the right by setting `side="right"` on the provider.
```tsx
"use client";
import {Sidebar} from "@darkcode-ui/react";
import {Folder, Gear, House, Persons} from "@gravity-ui/icons";
import {Brand, DemoMain, NavItem} from "./shared";
export function SidebarRightSide() {
return (
} label="Dashboard" />
} label="Projects" />
} label="Team" />
} label="Settings" />
);
}
```
### Icon Only
A permanently collapsed icon-only sidebar with tooltips on each item.
```tsx
"use client";
import type {ReactNode} from "react";
import {Avatar, Sidebar} from "@darkcode-ui/react";
import {ChartColumn, Folder, Gear, House, Persons} from "@gravity-ui/icons";
import {DemoMain} from "./shared";
function IconItem({icon, isCurrent, label}: {icon: ReactNode; label: string; isCurrent?: boolean}) {
return (
{icon}{label}
);
}
export function SidebarIconOnly() {
return (