Sidebar
Composable, collapsible app sidebar.
Import
tsx
import { Sidebar, SidebarProvider, SidebarTrigger, SidebarContent, SidebarMenu, SidebarMenuItem, SidebarMenuButton } from "@cooud-ui/ui";
bash
npx cooud-ui add sidebar
Examples
API Reference
Generated from the component's exported types.
SidebarProviderProps
Extends HTMLAttributes<HTMLDivElement>
| Prop | Type | Default | Description |
|---|---|---|---|
defaultOpen | boolean | true | Default desktop open state when uncontrolled. |
open | boolean | — | Controlled desktop open state. |
onOpenChange | (open: boolean) => void | — | — |
enableKeyboardShortcut | boolean | true | Enable the Ctrl/Cmd+B toggle shortcut. |
SidebarProps
Extends HTMLAttributes<HTMLDivElement>
| Prop | Type | Default | Description |
|---|---|---|---|
side | "left" | "right" | "left" | — |
variant | "sidebar" | "floating" | "inset" | "sidebar" | — |
collapsible | "offcanvas" | "icon" | "none" | "icon" | — |
aria-label | string | — | Accessible label for the navigation landmark. |
SidebarTriggerProps
Extends ButtonHTMLAttributes<HTMLButtonElement>
| Prop | Type | Default | Description |
|---|---|---|---|
asChild | boolean | false | Render through a custom element while keeping the toggle behavior. |
SidebarGroupLabelProps
Extends HTMLAttributes<HTMLDivElement>
| Prop | Type | Default | Description |
|---|---|---|---|
asChild | boolean | false | — |
SidebarMenuButtonProps
Extends ButtonHTMLAttributes<HTMLButtonElement>, VariantProps<typeof sidebarMenuButtonVariants>
| Prop | Type | Default | Description |
|---|---|---|---|
asChild | boolean | false | — |
isActive | boolean | false | — |
tooltip | ReactNode | ComponentPropsWithoutRef<typeof TooltipContent> | — | Tooltip content shown only when the sidebar is collapsed to icons on desktop. Accepts a string or full `TooltipContent` props. |
size | "sm" | "md" | "lg" | "md" | — |
SidebarMenuSubButtonProps
Extends ButtonHTMLAttributes<HTMLButtonElement>
| Prop | Type | Default | Description |
|---|---|---|---|
asChild | boolean | false | — |
isActive | boolean | false | — |
size | "sm" | "md" | "md" | — |