Sidebar component for creating collapsible side navigation panels. Built with Radix UI and Vaul for smooth animations and accessibility.
npx shadcn@latest add /r/sidebar.jsonimport { 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 });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.