Sidebar
Sidebar is the app's main navigation panel. It collapses to an icon rail or off screen, and opens as a Sheet on narrow screens. Wrap the app shell in SidebarProvider and put the page content in SidebarInset.
Installation
Run npx nxds-cli@latest init first if nxds isn’t set up in your app yet. See Install.
Usage
Composition
Examples
With submenu
Nest pages under a menu item with SidebarMenuSub.
Compact
Set size="sm" on every row for a denser sidebar with 12px text.
Flat
Skip the group parts and put nx:p-2 on SidebarContent for a flat list of links.
Props
Sidebar
| Prop | Type | Default | Description |
|---|---|---|---|
collapsible | "icon" | "none" | "offcanvas" | "offcanvas" | How it collapses: slides off screen, shrinks to an icon rail, or never. |
side | "left" | "right" | "left" | Edge the sidebar docks to. |
variant | "inset" | "floating" | "sidebar" | "sidebar" | Visual style. |
SidebarContent
SidebarContent adds no props of its own; it accepts the props of the element or primitive it wraps.
SidebarFooter
SidebarFooter adds no props of its own; it accepts the props of the element or primitive it wraps.
SidebarGroup
SidebarGroup adds no props of its own; it accepts the props of the element or primitive it wraps.
SidebarGroupAction
| Prop | Type | Default | Description |
|---|---|---|---|
asChild | boolean | false | Renders the child element instead. |
SidebarGroupContent
SidebarGroupContent adds no props of its own; it accepts the props of the element or primitive it wraps.
SidebarGroupLabel
| Prop | Type | Default | Description |
|---|---|---|---|
asChild | boolean | false | Renders the child element instead, such as a heading. |
SidebarHeader
SidebarHeader adds no props of its own; it accepts the props of the element or primitive it wraps.
SidebarInput
| Prop | Type | Default | Description |
|---|---|---|---|
size | "default" | "sm" | "lg" | null | "default" | No description |
variant | "ghost" | "borderless" | "bordered" | null | "bordered" | No description |
SidebarInset
SidebarInset adds no props of its own; it accepts the props of the element or primitive it wraps.
SidebarMenu
SidebarMenu adds no props of its own; it accepts the props of the element or primitive it wraps.
SidebarMenuAction
| Prop | Type | Default | Description |
|---|---|---|---|
asChild | boolean | false | Renders the child element instead. |
showOnHover | boolean | false | Shows the action only on hover or focus of the menu item. |
SidebarMenuBadge
SidebarMenuBadge adds no props of its own; it accepts the props of the element or primitive it wraps.
SidebarMenuButton
| Prop | Type | Default | Description |
|---|---|---|---|
asChild | boolean | false | Renders the child element instead, such as a router link. |
isActive | boolean | false | Marks the item as the current page. |
size | "default" | "sm" | "lg" | null | "default" | No description |
tooltip | string | TooltipContentProps | No default documented | Tooltip shown only on the icon rail. A string or |
variant | "default" | "outline" | null | "default" | No description |
SidebarMenuItem
SidebarMenuItem adds no props of its own; it accepts the props of the element or primitive it wraps.
SidebarMenuSkeleton
| Prop | Type | Default | Description |
|---|---|---|---|
showIcon | boolean | false | Adds an icon-sized block before the text bar. |
SidebarMenuSub
SidebarMenuSub adds no props of its own; it accepts the props of the element or primitive it wraps.
SidebarMenuSubButton
| Prop | Type | Default | Description |
|---|---|---|---|
asChild | boolean | false | Renders the child element instead, such as a router link. |
isActive | boolean | false | Marks the sub-item as the current page. |
size | "sm" | "md" | "md" | Text size of the sub-item. |
SidebarMenuSubItem
SidebarMenuSubItem adds no props of its own; it accepts the props of the element or primitive it wraps.
SidebarProvider
| Prop | Type | Default | Description |
|---|---|---|---|
defaultOpen | boolean | true | Opens the sidebar on first render when uncontrolled. The open state is saved to a |
onOpenChange | ((open: boolean) => void) | No default documented | Called when the open state changes. |
open | boolean | No default documented | Controlled open state. |
SidebarRail
SidebarRail adds no props of its own; it accepts the props of the element or primitive it wraps.
SidebarSeparator
SidebarSeparator adds no props of its own; it accepts the props of the element or primitive it wraps.
SidebarTrigger
| Prop | Type | Default | Description |
|---|---|---|---|
asChild | boolean | false | Renders the child, such as an |
endIcon | ReactNode | No default documented | Decorative icon after the label. Use |
loading | boolean | false | Disables the button and shows a spinner in place of its content. |
size | "default" | "sm" | "lg" | "icon-sm" | "icon" | "icon-lg" | null | "icon" | No description |
startIcon | ReactNode | No default documented | Decorative icon before the label. Use |
variant | "link" | "default" | "error" | "destructive" | "outline" | "dashed" | "secondary" | "ghost" | null | "ghost" | No description |
Sidebar is the app's main navigation panel. It collapses to an icon rail or off screen, and opens as a Sheet on narrow screens. Wrap the app shell in SidebarProvider and put the page content in SidebarInset.
Installation
Copy and paste the following code into your project.
components/sidebar/Sidebar.vue components/sidebar/SidebarContent.vue components/sidebar/SidebarFooter.vue components/sidebar/SidebarGroup.vue components/sidebar/SidebarGroupAction.vue components/sidebar/SidebarGroupContent.vue components/sidebar/SidebarGroupLabel.vue components/sidebar/SidebarHeader.vue components/sidebar/SidebarInput.vue components/sidebar/SidebarInset.vue components/sidebar/SidebarMenu.vue components/sidebar/SidebarMenuAction.vue components/sidebar/SidebarMenuBadge.vue components/sidebar/SidebarMenuButton.vue components/sidebar/SidebarMenuItem.vue components/sidebar/SidebarMenuSkeleton.vue components/sidebar/SidebarMenuSub.vue components/sidebar/SidebarMenuSubButton.vue components/sidebar/SidebarMenuSubItem.vue components/sidebar/SidebarProvider.vue components/sidebar/SidebarRail.vue components/sidebar/SidebarSeparator.vue components/sidebar/SidebarTrigger.vue components/sidebar/index.ts components/sidebar/sidebar-context.ts Keep each file at the path shown above it.
Paths are relative to
packages/vue/src/. Keep the same folders under your@/root, and the imports between files work without edits.
Usage
Examples
With submenu
Nest pages under a menu item with SidebarMenuSub.
Compact
Set size="sm" on every row for a denser sidebar with 12px text.
Flat
Skip the group parts and put nx:p-2 on SidebarContent for a flat list of links.
Props
Sidebar
| Prop | Type | Default | Description |
|---|---|---|---|
collapsible | "icon" | "offcanvas" | "none" | "offcanvas" | How it collapses: slides off screen, shrinks to an icon rail, or never. |
side | "right" | "left" | "left" | Edge the sidebar docks to. |
variant | "floating" | "inset" | "sidebar" | "sidebar" | Visual style. |
SidebarContent
SidebarContent adds no props of its own; it accepts the props of the element or primitive it wraps.
SidebarFooter
SidebarFooter adds no props of its own; it accepts the props of the element or primitive it wraps.
SidebarGroup
SidebarGroup adds no props of its own; it accepts the props of the element or primitive it wraps.
SidebarGroupAction
SidebarGroupAction adds no props of its own; it accepts the props of the element or primitive it wraps.
SidebarGroupContent
SidebarGroupContent adds no props of its own; it accepts the props of the element or primitive it wraps.
SidebarGroupLabel
SidebarGroupLabel adds no props of its own; it accepts the props of the element or primitive it wraps.
SidebarHeader
SidebarHeader adds no props of its own; it accepts the props of the element or primitive it wraps.
SidebarInput
| Prop | Type | Default | Description |
|---|---|---|---|
size | "default" | "sm" | "lg" | null | "default" | No description |
variant | "ghost" | "bordered" | "borderless" | null | "bordered" | No description |
SidebarInset
SidebarInset adds no props of its own; it accepts the props of the element or primitive it wraps.
SidebarMenu
SidebarMenu adds no props of its own; it accepts the props of the element or primitive it wraps.
SidebarMenuAction
| Prop | Type | Default | Description |
|---|---|---|---|
showOnHover | boolean | false | Shows the action only on hover or focus of the menu item. |
SidebarMenuBadge
SidebarMenuBadge adds no props of its own; it accepts the props of the element or primitive it wraps.
SidebarMenuButton
| Prop | Type | Default | Description |
|---|---|---|---|
isActive | boolean | false | Marks the item as the current page. |
size | "default" | "sm" | "lg" | null | "default" | No description |
tooltip | string | TooltipContentProps | No default documented | Tooltip shown only on the icon rail. A string or |
variant | "default" | "outline" | null | "default" | No description |
SidebarMenuItem
SidebarMenuItem adds no props of its own; it accepts the props of the element or primitive it wraps.
SidebarMenuSkeleton
| Prop | Type | Default | Description |
|---|---|---|---|
showIcon | boolean | false | Adds an icon-sized block before the text bar. |
SidebarMenuSub
SidebarMenuSub adds no props of its own; it accepts the props of the element or primitive it wraps.
SidebarMenuSubButton
| Prop | Type | Default | Description |
|---|---|---|---|
isActive | boolean | false | Marks the sub-item as the current page. |
size | "sm" | "md" | "md" | Text size of the sub-item. |
SidebarMenuSubItem
SidebarMenuSubItem adds no props of its own; it accepts the props of the element or primitive it wraps.
SidebarProvider
| Prop | Type | Default | Description |
|---|---|---|---|
defaultOpen | boolean | true | Opens the sidebar on first render when uncontrolled. The open state is saved to a |
open | boolean | No default documented | Controlled open state. |
SidebarRail
SidebarRail adds no props of its own; it accepts the props of the element or primitive it wraps.
SidebarSeparator
SidebarSeparator adds no props of its own; it accepts the props of the element or primitive it wraps.
SidebarTrigger
| Prop | Type | Default | Description |
|---|---|---|---|
disabled | boolean | No default documented | No description |
loading | boolean | false | Disables the button and shows a spinner in place of its content. |
size | "default" | "sm" | "lg" | "icon-sm" | "icon" | "icon-lg" | null | "icon" | No description |
type | "button" | "submit" | "reset" | "button" | No description |
variant | "default" | "destructive" | "error" | "outline" | "dashed" | "secondary" | "ghost" | "link" | null | "ghost" | No description |