• Docs
  • Components
  • Blocks
  • Admin
CtrlK
Get Started
  • Introduction
  • Setup
  • CLI
  • VS Code Extension
  • Figma Code Connect
  • MCP Server
  • llms.txt
  • Changelog
Foundations
  • Design Tokens
  • Theming & Modes
  • Semantic Colors
  • Spacing
  • Typography
Testing
  • Test Guide
  • Performance Tests
  • Visual Regression
Components
  • Accordion
  • Activity Feed
  • Alert
  • Avatar
  • Badge
  • Breadcrumbs
  • Button
  • Card
  • Carousel
  • Checkbox
  • Collapsible
  • Combobox
  • Command Palette
  • Context Menu
  • Date Picker
  • Dialog
  • Dropdown Menu
  • File Upload
  • Hover Card
  • Input
  • Kbd
  • Label
  • Menubar
  • Metric Card
  • Multi Select
  • Navigation Menu
  • Pagination
  • Popover
  • Progress
  • Quick Actions
  • Radio
  • Rating
  • Resizable
  • Segmented Control
  • Select
  • Separator
  • Sheet
  • Skeleton
  • Slider
  • Spinner
  • Split Button
  • Stepper
  • Switch
  • Table
  • Tabs
  • Tag Input
  • Textarea
  • Timeline
  • Toast
  • Toggle
  • Toggle Group
  • Tooltip
  • Tree View
Blocks
  • Activity Feed
  • App Shell
  • Authentication Block
  • Benefits Section
  • Cta Section
  • Data Table
  • Empty State
  • Faq Section
  • Feature Grid Section
  • Footer Section
  • Hero Section
  • Kpi Dashboard
  • Kpi Strip
  • Link Card
  • Metric Card
  • Navigation Header
  • Pagination Footer
  • Pricing Table
  • Quick Actions
  • Settings Screen
Resources
  • API Reference

Sidebar

Sidebar component for creating collapsible side navigation panels. Built with Radix UI and Vaul for smooth animations and accessibility.

Basic Sidebar

Install

npx shadcn@latest add /r/sidebar.json

Code Examples

import { Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarMenu, SidebarMenuItem, SidebarMenuButton, SidebarTrigger, DocumentContent } from "@fragment_ui/ui";

<Sidebar>
  <SidebarHeader>
    <h2>Header</h2>
  </SidebarHeader>
  <SidebarContent>
    <SidebarGroup>
      <SidebarGroupLabel>Navigation</SidebarGroupLabel>
      <SidebarGroupContent>
        <SidebarMenu>
          <SidebarMenuItem>
            <SidebarMenuButton>Home</SidebarMenuButton>
          </SidebarMenuItem>
        </SidebarMenu>
      </SidebarGroupContent>
    </SidebarGroup>
  </SidebarContent>
  <SidebarFooter>
    <p>Footer</p>
  </SidebarFooter>
</Sidebar>

// Note: Sidebar uses Vaul.Drawer which requires browser APIs.
// For Next.js SSR, wrap Sidebar in dynamic import with ssr: false:
import dynamic from "next/dynamic";
const ClientSidebar = dynamic(() => import("@fragment_ui/ui").then(mod => mod.Sidebar), { ssr: false });

Components

  • Sidebar - Root component that wraps all sidebar content
  • SidebarTrigger - Button to toggle sidebar visibility
  • SidebarHeader - Header section of the sidebar
  • SidebarContent - Main content area of the sidebar
  • SidebarFooter - Footer section of the sidebar
  • SidebarGroup - Container for grouping sidebar items
  • SidebarGroupLabel - Label for a sidebar group
  • SidebarGroupContent - Content container for a sidebar group
  • SidebarMenu - Menu container for sidebar items
  • SidebarMenuItem - Individual menu item container
  • SidebarMenuButton - Button component for menu items

Accessibility

Sidebar is built with Radix UI primitives and Vaul for drawer functionality, ensuring full keyboard navigation and screen reader support. The component includes proper ARIA attributes and follows WCAG 2.1 guidelines.