Usage
The DashboardSidebar component is used to display a sidebar. Its state (size, collapsed, etc.) will be saved based on the storage and storage-key props you provide to the DashboardGroup component.
Use it inside the default slot of the DashboardGroup component:
<template>
<B24DashboardGroup>
<B24DashboardSidebar />
<slot />
</B24DashboardGroup>
</template>
resizable prop, so wrap it in a container (e.g., <div class="flex flex-1">) if you use page transitions or require a single root for layout.Use the header, default and footer slots to customize the sidebar and the body or content slots to customize the sidebar menu.
Resizable
Use the resizable prop to make the sidebar resizable.
<template>
<B24DashboardSidebar resizable>
<Placeholder class="ms-2 h-96" />
</B24DashboardSidebar>
</template>
Collapsible
Use the collapsible prop to make the sidebar collapsible when dragging near the edge of the screen.
DashboardSidebarCollapse component will have no effect if the sidebar is not collapsible.<template>
<B24DashboardSidebar resizable collapsible>
<Placeholder class="ms-2 h-96" />
</B24DashboardSidebar>
</template>
collapsed state in the slot props to customize the content of the sidebar when it is collapsed.Size
Use the min-size, max-size, default-size and collapsed-size props (px) to customize the size of the sidebar.
<template>
<B24DashboardSidebar
resizable
collapsible
:min-size="200"
:default-size="240"
:max-size="250"
:collapsed-size="66"
>
<Placeholder class="ms-2 h-96" />
</B24DashboardSidebar>
</template>
unit prop on the DashboardGroup component.collapsed-size prop is set to 0 by default but the sidebar has a min-w-16 to make sure it is visible.Side
Use the side prop to change the side of the sidebar. Defaults to left.
<template>
<B24DashboardSidebar side="right" resizable collapsible>
<Placeholder class="ms-2 h-96" />
</B24DashboardSidebar>
</template>
Mode
Use the mode prop to change the mode of the sidebar menu. Defaults to slideover.
Use the body slot to fill the menu body (under the header) or the content slot to fill the entire menu.
menu prop to customize the menu of the sidebar, it will adapt depending on the mode you choose.DashboardGroup, DashboardPanel and DashboardNavbar components as they are required to demonstrate the sidebar on mobile.Toggle
Use the toggle prop to customize the DashboardSidebarToggle component displayed on mobile.
You can pass any property from the Button component to customize it.
Toggle Side
Use the toggle-side prop to change the side of the toggle button. Defaults to left.
Examples
Control open state
You can control the open state by using the open prop or the v-model:open directive.
defineShortcuts, you can toggle the open state of the DashboardSidebar by pressing O.Control collapsed state
You can control the collapsed state by using the collapsed prop or the v-model:collapsed directive.
defineShortcuts, you can toggle the collapsed state of the DashboardSidebar by pressing C.API
Props
Slots
Theme
export default defineAppConfig({
b24ui: {
dashboardSidebar: {
slots: {
root: 'relative hidden lg:flex flex-col min-h-svh min-w-16 w-(--width) shrink-0',
header: 'h-(--b24ui-header-height) shrink-0 flex items-center gap-1.5 px-4',
body: 'flex flex-col gap-4 flex-1 overflow-y-auto py-2 scrollbar-thin scrollbar-transparent',
footer: 'shrink-0 flex items-center gap-1.5 px-4 py-2',
toggle: '',
handle: '',
content: 'lg:hidden',
overlay: 'lg:hidden'
},
variants: {
menu: {
true: {
header: 'sm:px-6',
body: 'sm:px-6',
footer: 'sm:px-6'
}
},
side: {
left: {
root: 'border-e border-(--ui-color-divider-default)'
},
right: {
root: ''
}
},
toggleSide: {
left: {
toggle: ''
},
right: {
toggle: 'ms-auto'
}
}
}
}
}
})
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import bitrix24UIPluginVite from '@bitrix24/b24ui-nuxt/vite'
export default defineConfig({
plugins: [
vue(),
bitrix24UIPluginVite({
b24ui: {
dashboardSidebar: {
slots: {
root: 'relative hidden lg:flex flex-col min-h-svh min-w-16 w-(--width) shrink-0',
header: 'h-(--b24ui-header-height) shrink-0 flex items-center gap-1.5 px-4',
body: 'flex flex-col gap-4 flex-1 overflow-y-auto py-2 scrollbar-thin scrollbar-transparent',
footer: 'shrink-0 flex items-center gap-1.5 px-4 py-2',
toggle: '',
handle: '',
content: 'lg:hidden',
overlay: 'lg:hidden'
},
variants: {
menu: {
true: {
header: 'sm:px-6',
body: 'sm:px-6',
footer: 'sm:px-6'
}
},
side: {
left: {
root: 'border-e border-(--ui-color-divider-default)'
},
right: {
root: ''
}
},
toggleSide: {
left: {
toggle: ''
},
right: {
toggle: 'ms-auto'
}
}
}
}
}
})
]
})