Loading...
Installation
Install the following dependencies:
Copy and paste the following code into your project.
Loading...
Update the import paths to match your project setup.
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...
Menu Actions
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
| Input | Type | Default | Description |
|---|---|---|---|
width | string | SIDEBAR_WIDTH | Sets the expanded sidebar width CSS variable. |
iconWidth | string | SIDEBAR_WIDTH_ICON | Sets the icon-only sidebar width CSS variable. |
<app-sidebar>
Inputs
| Input | Type | Default | Description |
|---|---|---|---|
class | string | "" | 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
| Input | Type | Default | Description |
|---|---|---|---|
size | "default" | "sm" | "lg" | "default" | Sets the menu-button size. |
variant | "default" | "outline" | "default" | Sets the menu-button visual style. |
isActive | boolean | false | Marks the menu button as representing the active view. |
[appSidebarMenuAction]
Inputs
| Input | Type | Default | Description |
|---|---|---|---|
showOnHover | boolean | false | Shows the action when its menu item is hovered. |
[appSidebarMenuSubButton]
Inputs
| Input | Type | Default | Description |
|---|---|---|---|
size | "sm" | "md" | "md" | Sets the submenu-button size. |
isActive | boolean | false | Marks the submenu button as representing the active view. |
Controller and Utilities
Call useSidebar() inside an Angular injection context to access the nearest
SidebarController.
| Member | Type | Description |
|---|---|---|
open | WritableSignal<boolean> | Desktop expanded state. |
openMobile | WritableSignal<boolean> | Mobile overlay state. |
isMobile | WritableSignal<boolean> | Whether the viewport is at most 767 pixels wide. |
state | Signal<"expanded" | "collapsed"> | State derived from open. |
setOpen(value) | (value: boolean) => void | Updates desktop state and persists it in a cookie. |
setOpenMobile(value) | (value: boolean) => void | Updates the mobile state. |
toggleSidebar() | () => void | Toggles mobile or desktop state for the current viewport. |
Constants and Imports
| Export | Default value | Description |
|---|---|---|
SIDEBAR_COOKIE_NAME | "sidebar_state" | Cookie used to persist desktop state. |
SIDEBAR_COOKIE_MAX_AGE | 604800 | Cookie 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. |
Angular
React
Solid
Svelte
Vue