Search documentation

Search the documentation and open a page.

A composable, themeable and customizable sidebar component.

Loading...

Installation

pnpm dlx shadcn@latest add @wirekyt/sidebar

Composition

<app-sidebar-provider> ├── <app-sidebar> │ ├── [appSidebarHeader] │ │ └── <input appSidebarInput> (optional) │ ├── [appSidebarSeparator] (optional) │ ├── [appSidebarContent] │ │ └── [appSidebarGroup] │ │ ├── [appSidebarGroupLabel] │ │ ├── [appSidebarGroupAction] (optional) │ │ └── [appSidebarGroupContent] │ │ └── [appSidebarMenu] │ │ └── [appSidebarMenuItem] │ │ ├── [appSidebarMenuButton] │ │ ├── [appSidebarMenuAction] (optional) │ │ ├── [appSidebarMenuBadge] (optional) │ │ ├── [appSidebarMenuSkeleton] (optional) │ │ └── [appSidebarMenuSub] (optional) │ │ └── [appSidebarMenuSubItem] │ │ └── [appSidebarMenuSubButton] │ ├── [appSidebarFooter] │ └── <button appSidebarRail> (optional) ├── <button app-sidebar-trigger> └── [appSidebarInset]

Examples

Default

Loading...

Floating

Loading...

In A Dialog

Loading...
Loading...

API Reference

<app-sidebar-provider>

Provides a SidebarController to every sidebar component in its content and handles the Ctrl/Command + B keyboard shortcut.

Inputs

InputTypeDefaultDescription
widthstringSIDEBAR_WIDTHSets the expanded sidebar width CSS variable.
iconWidthstringSIDEBAR_WIDTH_ICONSets the icon-only sidebar width CSS variable.

<app-sidebar>

Inputs

InputTypeDefaultDescription
classstring""Additional classes applied to the fixed sidebar container.
side"left" | "right""left"Edge on which the sidebar is displayed.
variant"sidebar" | "floating" | "inset""sidebar"Sets the visual sidebar layout.
collapsible"offcanvas" | "icon" | "none""offcanvas"Sets how the sidebar behaves when collapsed.

[appSidebarMenuButton]

Inputs

InputTypeDefaultDescription
size"default" | "sm" | "lg""default"Sets the menu-button size.
variant"default" | "outline""default"Sets the menu-button visual style.
isActivebooleanfalseMarks the menu button as representing the active view.

[appSidebarMenuAction]

Inputs

InputTypeDefaultDescription
showOnHoverbooleanfalseShows the action when its menu item is hovered.

[appSidebarMenuSubButton]

Inputs

InputTypeDefaultDescription
size"sm" | "md""md"Sets the submenu-button size.
isActivebooleanfalseMarks the submenu button as representing the active view.

Controller and Utilities

Call useSidebar() inside an Angular injection context to access the nearest SidebarController.

MemberTypeDescription
openWritableSignal<boolean>Desktop expanded state.
openMobileWritableSignal<boolean>Mobile overlay state.
isMobileWritableSignal<boolean>Whether the viewport is at most 767 pixels wide.
stateSignal<"expanded" | "collapsed">State derived from open.
setOpen(value)(value: boolean) => voidUpdates desktop state and persists it in a cookie.
setOpenMobile(value)(value: boolean) => voidUpdates the mobile state.
toggleSidebar()() => voidToggles mobile or desktop state for the current viewport.

Constants and Imports

ExportDefault valueDescription
SIDEBAR_COOKIE_NAME"sidebar_state"Cookie used to persist desktop state.
SIDEBAR_COOKIE_MAX_AGE604800Cookie lifetime in seconds.
SIDEBAR_WIDTH"16.25rem"Default expanded width.
SIDEBAR_WIDTH_MOBILE"18rem"Default mobile width.
SIDEBAR_WIDTH_ICON"3rem"Default icon-only width.
SidebarImports—Readonly collection containing all sidebar UI components.