Skip to content
Menus & Navigation

Sidebar

Composable, collapsible app sidebar.

Import

tsx
import { Sidebar, SidebarProvider, SidebarTrigger, SidebarContent, SidebarMenu, SidebarMenuItem, SidebarMenuButton } from "@cronus-ui/ui";
bash
npx cronus-ui add sidebar

Examples

.cronus

The same component declared in Cronus. Emitted at build time from the audit fixtures — the kernel renders it as HTML with no React.

PortedParity: MatchGeometry 1/1Pixel diff 0 pxLogic 1/1Parity scoreboard
default.cronus
app "audit-fixtures" {
  port 5176
}

style {
  preset aurora
  theme dark
}

component SidebarDefault layout:inline style:sidebar {
  aria-label:"Sidebar"
  label "Sidebar"
  text "Home"
  text "Inbox"
}

page "/audit/sidebar/default" type:custom {
  use SidebarDefault
}

API Reference

Generated from the component's exported types.

SidebarProviderProps

Extends HTMLAttributes<HTMLDivElement>

Skip SidebarProviderProps props table
PropTypeDefaultDescription
defaultOpen
booleantrueDefault desktop open state when uncontrolled.
open
boolean—Controlled desktop open state.
onOpenChange
(open: boolean) => void—Called when the open state changes.
enableKeyboardShortcut
booleantrueEnable the Ctrl/Cmd+B toggle shortcut.
className
string—Additional class names merged onto the root.
children
ReactNode—Contents of the component.
id
string—DOM id of the root element.

SidebarProps

Extends HTMLAttributes<HTMLDivElement>

Skip SidebarProps props table
PropTypeDefaultDescription
side
"left" | "right""left"—
variant
"sidebar" | "floating" | "inset""sidebar"Visual variant.
collapsible
"offcanvas" | "icon" | "none""icon"—
aria-label
string—Accessible label for the navigation landmark.
className
string—Additional class names merged onto the root.
children
ReactNode—Contents of the component.
id
string—DOM id of the root element.

SidebarTriggerProps

Extends ButtonHTMLAttributes<HTMLButtonElement>

Skip SidebarTriggerProps props table
PropTypeDefaultDescription
asChild
booleanfalseRender through a custom element while keeping the toggle behavior.
type
string—Native type of the underlying element.
disabled
boolean—Disables pointer and keyboard interaction.
onClick
(event: MouseEvent) => void—Click handler.
children
ReactNode—Contents of the component.
className
string—Additional class names merged onto the root.

SidebarGroupLabelProps

Extends HTMLAttributes<HTMLDivElement>

Skip SidebarGroupLabelProps props table
PropTypeDefaultDescription
asChild
booleanfalseRender as the child element via Slot.
className
string—Additional class names merged onto the root.
children
ReactNode—Contents of the component.
id
string—DOM id of the root element.

SidebarMenuButtonProps

Extends ButtonHTMLAttributes<HTMLButtonElement>, VariantProps<typeof sidebarMenuButtonVariants>

Skip SidebarMenuButtonProps props table
PropTypeDefaultDescription
asChild
booleanfalseRender as the child element via Slot.
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"One of "sm" | "md" | "lg".
children
ReactNode—Contents of the component.
className
string—Additional class names merged onto the root.
type
string—Native type of the underlying element.
disabled
boolean—Disables pointer and keyboard interaction.
onClick
(event: MouseEvent) => void—Click handler.

SidebarMenuSubButtonProps

Extends ButtonHTMLAttributes<HTMLButtonElement>

Skip SidebarMenuSubButtonProps props table
PropTypeDefaultDescription
asChild
booleanfalseRender as the child element via Slot.
isActive
booleanfalse—
size
"sm" | "md""md"Control size.
type
string—Native type of the underlying element.
disabled
boolean—Disables pointer and keyboard interaction.
onClick
(event: MouseEvent) => void—Click handler.
children
ReactNode—Contents of the component.
className
string—Additional class names merged onto the root.

SidebarRailProps

Extends ButtonHTMLAttributes<HTMLButtonElement>

Skip SidebarRailProps props table
PropTypeDefaultDescription
type
string—Native type of the underlying element.
disabled
boolean—Disables pointer and keyboard interaction.
onClick
(event: MouseEvent) => void—Click handler.
children
ReactNode—Contents of the component.
className
string—Additional class names merged onto the root.

SidebarInsetProps

Extends HTMLAttributes<HTMLDivElement>

Skip SidebarInsetProps props table
PropTypeDefaultDescription
className
string—Additional class names merged onto the root.
children
ReactNode—Contents of the component.
id
string—DOM id of the root element.

SidebarHeaderProps

Extends HTMLAttributes<HTMLDivElement>

Skip SidebarHeaderProps props table
PropTypeDefaultDescription
className
string—Additional class names merged onto the root.
children
ReactNode—Contents of the component.
id
string—DOM id of the root element.

SidebarFooterProps

Extends HTMLAttributes<HTMLDivElement>

Skip SidebarFooterProps props table
PropTypeDefaultDescription
className
string—Additional class names merged onto the root.
children
ReactNode—Contents of the component.
id
string—DOM id of the root element.

SidebarContentProps

Extends HTMLAttributes<HTMLDivElement>

Skip SidebarContentProps props table
PropTypeDefaultDescription
className
string—Additional class names merged onto the root.
children
ReactNode—Contents of the component.
id
string—DOM id of the root element.

SidebarSeparatorProps

Extends ComponentPropsWithoutRef<typeof Separator>

Skip SidebarSeparatorProps props table
PropTypeDefaultDescription
asChild
boolean—Render as the child element via Slot.
children
ReactNode—Contents of the component.
className
string—Additional class names merged onto the root.

SidebarGroupProps

Extends HTMLAttributes<HTMLDivElement>

Skip SidebarGroupProps props table
PropTypeDefaultDescription
className
string—Additional class names merged onto the root.
children
ReactNode—Contents of the component.
id
string—DOM id of the root element.

SidebarGroupContentProps

Extends HTMLAttributes<HTMLDivElement>

Skip SidebarGroupContentProps props table
PropTypeDefaultDescription
className
string—Additional class names merged onto the root.
children
ReactNode—Contents of the component.
id
string—DOM id of the root element.

SidebarMenuProps

Extends HTMLAttributes<HTMLUListElement>

Skip SidebarMenuProps props table
PropTypeDefaultDescription
className
string—Additional class names merged onto the root.
children
ReactNode—Contents of the component.
id
string—DOM id of the root element.

SidebarMenuItemProps

Extends HTMLAttributes<HTMLLIElement>

Skip SidebarMenuItemProps props table
PropTypeDefaultDescription
className
string—Additional class names merged onto the root.
children
ReactNode—Contents of the component.
id
string—DOM id of the root element.

SidebarMenuSubProps

Extends HTMLAttributes<HTMLUListElement>

Skip SidebarMenuSubProps props table
PropTypeDefaultDescription
className
string—Additional class names merged onto the root.
children
ReactNode—Contents of the component.
id
string—DOM id of the root element.

SidebarMenuSubItemProps

Extends HTMLAttributes<HTMLLIElement>

Skip SidebarMenuSubItemProps props table
PropTypeDefaultDescription
className
string—Additional class names merged onto the root.
children
ReactNode—Contents of the component.
id
string—DOM id of the root element.