Skip to content
Navigation

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>

PropTypeDefaultDescription
defaultOpen
booleantrueDefault desktop open state when uncontrolled.
open
booleanControlled desktop open state.
onOpenChange
(open: boolean) => void
enableKeyboardShortcut
booleantrueEnable the Ctrl/Cmd+B toggle shortcut.

SidebarProps

Extends HTMLAttributes<HTMLDivElement>

PropTypeDefaultDescription
side
"left" | "right""left"
variant
"sidebar" | "floating" | "inset""sidebar"
collapsible
"offcanvas" | "icon" | "none""icon"
aria-label
stringAccessible label for the navigation landmark.

SidebarTriggerProps

Extends ButtonHTMLAttributes<HTMLButtonElement>

PropTypeDefaultDescription
asChild
booleanfalseRender through a custom element while keeping the toggle behavior.

SidebarGroupLabelProps

Extends HTMLAttributes<HTMLDivElement>

PropTypeDefaultDescription
asChild
booleanfalse

SidebarMenuButtonProps

Extends ButtonHTMLAttributes<HTMLButtonElement>, VariantProps<typeof sidebarMenuButtonVariants>

PropTypeDefaultDescription
asChild
booleanfalse
isActive
booleanfalse
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>

PropTypeDefaultDescription
asChild
booleanfalse
isActive
booleanfalse
size
"sm" | "md""md"