Animated Sidebar
Preview
People
Wednesday, July 29
Good morning, Ava.
Your workspace stays in place while the navigation folds down to a focused icon rail.
Active view
People
Press ⌘B to toggle
<script setup lang="ts">
import {
AnimatedSidebarClose,
AnimatedSidebarContent,
AnimatedSidebarFooter,
AnimatedSidebarGroup,
AnimatedSidebarGroupContent,
AnimatedSidebarGroupLabel,
AnimatedSidebarHeader,
AnimatedSidebarInset,
AnimatedSidebarMenu,
AnimatedSidebarMenuButton,
AnimatedSidebarMenuItem,
AnimatedSidebarMenuSub,
AnimatedSidebarMenuSubButton,
AnimatedSidebarMenuSubItem,
AnimatedSidebar,
AnimatedSidebarProvider,
AnimatedSidebarRail,
AnimatedSidebarTrigger,
} from 'beui-vue'
import { ref, defineComponent, h, type PropType } from 'vue'
/** Inline Lucide glyphs for the layout demos (generated from lucide-react, ISC). Inner markup of 24x24 stroked icons. */
const ICONS: Record<string, string> = {
"ArrowRight": "<path d=\"M5 12h14\"></path><path d=\"m12 5 7 7-7 7\"></path>",
"ArrowUp": "<path d=\"m5 12 7-7 7 7\"></path><path d=\"M12 19V5\"></path>",
"ArrowUpRight": "<path d=\"M7 7h10v10\"></path><path d=\"M7 17 17 7\"></path>",
"BarChart3": "<path d=\"M3 3v16a2 2 0 0 0 2 2h16\"></path><path d=\"M18 17V9\"></path><path d=\"M13 17V5\"></path><path d=\"M8 17v-3\"></path>",
"Bell": "<path d=\"M10.268 21a2 2 0 0 0 3.464 0\"></path><path d=\"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326\"></path>",
"Braces": "<path d=\"M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1\"></path><path d=\"M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1\"></path>",
"Building2": "<path d=\"M10 12h4\"></path><path d=\"M10 8h4\"></path><path d=\"M14 21v-3a2 2 0 0 0-4 0v3\"></path><path d=\"M6 10H4a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-2\"></path><path d=\"M6 21V5a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v16\"></path>",
"Calendar": "<path d=\"M8 2v3\"></path><path d=\"M16 2v3\"></path><rect x=\"3\" y=\"3\" width=\"18\" height=\"18\" rx=\"2\"></rect><path d=\"M3 9h18\"></path>",
"CalendarClock": "<path d=\"M16 14v2.2l1.6 1\"></path><path d=\"M16 2v3\"></path><path d=\"M21 7.338V5a2 2 0 00-2-2H5a2 2 0 00-2 2v14a2 2 0 002 2h2.338\"></path><path d=\"M3 9h5.859\"></path><path d=\"M8 2v3\"></path><circle cx=\"16\" cy=\"16\" r=\"6\"></circle>",
"Check": "<path d=\"M20 6 9 17l-5-5\"></path>",
"CheckCircle2": "<circle cx=\"12\" cy=\"12\" r=\"10\"></circle><path d=\"m9 12 2 2 4-4\"></path>",
"ChevronDown": "<path d=\"m6 9 6 6 6-6\"></path>",
"ChevronLeft": "<path d=\"m15 18-6-6 6-6\"></path>",
"ChevronRight": "<path d=\"m9 18 6-6-6-6\"></path>",
"ChevronUp": "<path d=\"m18 15-6-6-6 6\"></path>",
"ChevronsUpDown": "<path d=\"m7 15 5 5 5-5\"></path><path d=\"m7 9 5-5 5 5\"></path>",
"Circle": "<circle cx=\"12\" cy=\"12\" r=\"10\"></circle>",
"CircleUserRound": "<path d=\"M17.925 20.056a6 6 0 0 0-11.851.001\"></path><circle cx=\"12\" cy=\"11\" r=\"4\"></circle><circle cx=\"12\" cy=\"12\" r=\"10\"></circle>",
"Command": "<path d=\"M15 6v12a3 3 0 1 0 3-3H6a3 3 0 1 0 3 3V6a3 3 0 1 0-3 3h12a3 3 0 1 0-3-3\"></path>",
"File": "<path d=\"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z\"></path><path d=\"M14 2v5a1 1 0 0 0 1 1h5\"></path>",
"FileCode2": "<path d=\"M4 12.15V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2h-3.35\"></path><path d=\"M14 2v5a1 1 0 0 0 1 1h5\"></path><path d=\"m5 16-3 3 3 3\"></path><path d=\"m9 22 3-3-3-3\"></path>",
"FileJson2": "<path d=\"M14 22h4a2 2 0 0 0 2-2V8a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 14 2H6a2 2 0 0 0-2 2v6\"></path><path d=\"M14 2v5a1 1 0 0 0 1 1h5\"></path><path d=\"M5 14a1 1 0 0 0-1 1v2a1 1 0 0 1-1 1 1 1 0 0 1 1 1v2a1 1 0 0 0 1 1\"></path><path d=\"M9 22a1 1 0 0 0 1-1v-2a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-2a1 1 0 0 0-1-1\"></path>",
"FileText": "<path d=\"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z\"></path><path d=\"M14 2v5a1 1 0 0 0 1 1h5\"></path><path d=\"M10 9H8\"></path><path d=\"M16 13H8\"></path><path d=\"M16 17H8\"></path>",
"Folder": "<path d=\"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z\"></path>",
"FolderKanban": "<path d=\"M4 20h16a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.93a2 2 0 0 1-1.66-.9l-.82-1.2A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13c0 1.1.9 2 2 2Z\"></path><path d=\"M8 10v4\"></path><path d=\"M12 10v2\"></path><path d=\"M16 10v6\"></path>",
"FolderOpen": "<path d=\"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2\"></path>",
"GitPullRequest": "<circle cx=\"18\" cy=\"18\" r=\"3\"></circle><circle cx=\"6\" cy=\"6\" r=\"3\"></circle><path d=\"M13 6h3a2 2 0 0 1 2 2v7\"></path><line x1=\"6\" x2=\"6\" y1=\"9\" y2=\"21\"></line>",
"GripVertical": "<circle cx=\"9\" cy=\"12\" r=\"1\"></circle><circle cx=\"9\" cy=\"5\" r=\"1\"></circle><circle cx=\"9\" cy=\"19\" r=\"1\"></circle><circle cx=\"15\" cy=\"12\" r=\"1\"></circle><circle cx=\"15\" cy=\"5\" r=\"1\"></circle><circle cx=\"15\" cy=\"19\" r=\"1\"></circle>",
"Heart": "<path d=\"M2 9.5a5.5 5.5 0 0 1 9.591-3.676.56.56 0 0 0 .818 0A5.49 5.49 0 0 1 22 9.5c0 2.29-1.5 4-3 5.5l-5.492 5.313a2 2 0 0 1-3 .019L5 15c-1.5-1.5-3-3.2-3-5.5\"></path>",
"Home": "<path d=\"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8\"></path><path d=\"M3 10a2 2 0 0 1 .709-1.528l7-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z\"></path>",
"House": "<path d=\"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8\"></path><path d=\"M3 10a2 2 0 0 1 .709-1.528l7-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z\"></path>",
"Inbox": "<polyline points=\"22 12 16 12 14 15 10 15 8 12 2 12\"></polyline><path d=\"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z\"></path>",
"Layers": "<path d=\"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z\"></path><path d=\"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12\"></path><path d=\"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17\"></path>",
"LayoutGrid": "<rect width=\"7\" height=\"7\" x=\"3\" y=\"3\" rx=\"1\"></rect><rect width=\"7\" height=\"7\" x=\"14\" y=\"3\" rx=\"1\"></rect><rect width=\"7\" height=\"7\" x=\"14\" y=\"14\" rx=\"1\"></rect><rect width=\"7\" height=\"7\" x=\"3\" y=\"14\" rx=\"1\"></rect>",
"ListTodo": "<path d=\"M13 5h8\"></path><path d=\"M13 12h8\"></path><path d=\"M13 19h8\"></path><path d=\"m3 17 2 2 4-4\"></path><rect x=\"3\" y=\"4\" width=\"6\" height=\"6\" rx=\"1\"></rect>",
"LoaderCircle": "<path d=\"M21 12a9 9 0 1 1-6.219-8.56\"></path>",
"Mail": "<path d=\"m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7\"></path><rect x=\"2\" y=\"4\" width=\"20\" height=\"16\" rx=\"2\"></rect>",
"MessageCircle": "<path d=\"M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719\"></path>",
"Minus": "<path d=\"M5 12h14\"></path>",
"Music": "<path d=\"M9 18V5l12-2v13\"></path><circle cx=\"6\" cy=\"18\" r=\"3\"></circle><circle cx=\"18\" cy=\"16\" r=\"3\"></circle>",
"NotebookTabs": "<path d=\"M2 6h4\"></path><path d=\"M2 10h4\"></path><path d=\"M2 14h4\"></path><path d=\"M2 18h4\"></path><rect width=\"16\" height=\"20\" x=\"4\" y=\"2\" rx=\"2\"></rect><path d=\"M15 2v20\"></path><path d=\"M15 7h5\"></path><path d=\"M15 12h5\"></path><path d=\"M15 17h5\"></path>",
"PackageCheck": "<path d=\"M12 22V12\"></path><path d=\"m16 17 2 2 4-4\"></path><path d=\"M21 11.127V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.729l7 4a2 2 0 0 0 2 .001l1.32-.753\"></path><path d=\"M3.29 7 12 12l8.71-5\"></path><path d=\"m7.5 4.27 8.997 5.148\"></path>",
"Palette": "<path d=\"M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z\"></path><circle cx=\"13.5\" cy=\"6.5\" r=\".5\" fill=\"currentColor\"></circle><circle cx=\"17.5\" cy=\"10.5\" r=\".5\" fill=\"currentColor\"></circle><circle cx=\"6.5\" cy=\"12.5\" r=\".5\" fill=\"currentColor\"></circle><circle cx=\"8.5\" cy=\"7.5\" r=\".5\" fill=\"currentColor\"></circle>",
"PanelLeft": "<rect width=\"18\" height=\"18\" x=\"3\" y=\"3\" rx=\"2\"></rect><path d=\"M9 3v18\"></path>",
"Plus": "<path d=\"M5 12h14\"></path><path d=\"M12 5v14\"></path>",
"RadioTower": "<path d=\"M4.9 16.1C1 12.2 1 5.8 4.9 1.9\"></path><path d=\"M7.8 4.7a6.14 6.14 0 0 0-.8 7.5\"></path><circle cx=\"12\" cy=\"9\" r=\"2\"></circle><path d=\"M16.2 4.8c2 2 2.26 5.11.8 7.47\"></path><path d=\"M19.1 1.9a9.96 9.96 0 0 1 0 14.1\"></path><path d=\"M9.5 18h5\"></path><path d=\"m8 22 4-11 4 11\"></path>",
"Rocket": "<path d=\"M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5\"></path><path d=\"M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09\"></path><path d=\"M9 12a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.4 22.4 0 0 1-4 2z\"></path><path d=\"M9 12H4s.55-3.03 2-4c1.62-1.08 5 .05 5 .05\"></path>",
"Search": "<path d=\"m21 21-4.34-4.34\"></path><circle cx=\"11\" cy=\"11\" r=\"8\"></circle>",
"Settings": "<path d=\"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915\"></path><circle cx=\"12\" cy=\"12\" r=\"3\"></circle>",
"ShieldCheck": "<path d=\"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z\"></path><path d=\"m9 12 2 2 4-4\"></path>",
"Sparkles": "<path d=\"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z\"></path><path d=\"M20 2v4\"></path><path d=\"M22 4h-4\"></path><circle cx=\"4\" cy=\"20\" r=\"2\"></circle>",
"Target": "<circle cx=\"12\" cy=\"12\" r=\"10\"></circle><circle cx=\"12\" cy=\"12\" r=\"6\"></circle><circle cx=\"12\" cy=\"12\" r=\"2\"></circle>",
"Undo2": "<path d=\"M9 14 4 9l5-5\"></path><path d=\"M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11\"></path>",
"Workflow": "<rect width=\"8\" height=\"8\" x=\"3\" y=\"3\" rx=\"2\"></rect><path d=\"M7 11v4a2 2 0 0 0 2 2h4\"></path><rect width=\"8\" height=\"8\" x=\"13\" y=\"13\" rx=\"2\"></rect>",
"X": "<path d=\"M18 6 6 18\"></path><path d=\"m6 6 12 12\"></path>"
}
export type LucideName = string
export const LucideIcon = defineComponent({
name: 'LucideIcon',
props: { name: { type: String as PropType<LucideName>, required: true }, size: { type: Number, default: 16 }, strokeWidth: { type: Number, default: 2 } },
setup: props => () => h('svg', {
xmlns: 'http://www.w3.org/2000/svg', width: props.size, height: props.size, viewBox: '0 0 24 24', fill: 'none', stroke: 'currentColor',
'stroke-width': props.strokeWidth, 'stroke-linecap': 'round', 'stroke-linejoin': 'round', 'aria-hidden': 'true', innerHTML: ICONS[props.name] ?? '',
}),
})
const destinations = [
{ label: 'People', icon: 'CircleUserRound', children: ['All people', 'Recent activity', 'Segments'] },
{ label: 'Companies', icon: 'Building2' },
{ label: 'Opportunities', icon: 'Target', children: ['Pipeline', 'Forecast', 'Closed deals'] },
{ label: 'Tasks', icon: 'ListTodo' },
{ label: 'Notes', icon: 'NotebookTabs' },
{ label: 'Workflows', icon: 'Workflow', children: ['Automations', 'Runs', 'Templates'] },
{ label: 'Dashboard', icon: 'LayoutGrid' },
] as { label: string; icon: string; children?: string[] }[]
const quick = [
{ label: 'Search', icon: 'Search', badge: undefined },
{ label: 'AI Assistant', icon: 'Sparkles', badge: undefined },
{ label: 'Inbox', icon: 'Inbox', badge: '4' },
]
const person = 'Ava Stone'
const email = '[email protected]'
const greeting = 'Ava'
const active = ref('People')
const openSection = ref<string | null>(null)
function selectDestination(label: string, children?: string[]) {
if (!children) {
active.value = label
openSection.value = null
return
}
openSection.value = openSection.value === label ? null : label
}
</script>
<template>
<div class="sidebar-demo">
<AnimatedSidebarProvider class="sidebar-shell">
<AnimatedSidebar aria-label="Solace workspace" collapsible="icon" class="sidebar-panel" panel-class-name="sidebar-surface">
<AnimatedSidebarHeader class="sidebar-header">
<div class="brand-row">
<div class="brand-mark"><LucideIcon name="Command" :size="16" /></div>
<button type="button" class="team-button">
<span class="team-name">Acme Inc</span>
<LucideIcon name="ChevronsUpDown" :size="14" class="muted" />
</button>
<AnimatedSidebarClose class="sidebar-close"><LucideIcon name="X" :size="16" /></AnimatedSidebarClose>
</div>
</AnimatedSidebarHeader>
<AnimatedSidebarContent class="sidebar-content">
<AnimatedSidebarGroup class="group-first">
<AnimatedSidebarGroupContent>
<AnimatedSidebarMenu>
<AnimatedSidebarMenuItem v-for="item in quick" :key="item.label">
<AnimatedSidebarMenuButton :badge="item.badge" @select="active = item.label">
<template #icon><LucideIcon :name="item.icon" :size="16" /></template>
{{ item.label }}
</AnimatedSidebarMenuButton>
</AnimatedSidebarMenuItem>
</AnimatedSidebarMenu>
</AnimatedSidebarGroupContent>
</AnimatedSidebarGroup>
<AnimatedSidebarGroup class="group-second">
<AnimatedSidebarGroupLabel>Workspaces</AnimatedSidebarGroupLabel>
<AnimatedSidebarGroupContent>
<AnimatedSidebarMenu>
<AnimatedSidebarMenuItem v-for="item in destinations" :key="item.label">
<AnimatedSidebarMenuButton
:is-active="active === item.label || item.children?.includes(active) === true"
:aria-expanded="item.children ? openSection === item.label : undefined"
@select="selectDestination(item.label, item.children)"
>
<template #icon><LucideIcon :name="item.icon" :size="16" /></template>
{{ item.label }}
</AnimatedSidebarMenuButton>
<AnimatedSidebarMenuSub v-if="item.children" :open="openSection === item.label">
<AnimatedSidebarMenuSubItem v-for="child in item.children" :key="child">
<AnimatedSidebarMenuSubButton :is-active="active === child" @select="active = child">{{ child }}</AnimatedSidebarMenuSubButton>
</AnimatedSidebarMenuSubItem>
</AnimatedSidebarMenuSub>
</AnimatedSidebarMenuItem>
</AnimatedSidebarMenu>
</AnimatedSidebarGroupContent>
</AnimatedSidebarGroup>
</AnimatedSidebarContent>
<AnimatedSidebarFooter class="sidebar-footer">
<button type="button" class="account-button">
<span class="avatar">AS</span>
<span class="account-text">
<span class="account-name">{{ person }}</span>
<span class="account-email">{{ email }}</span>
</span>
<LucideIcon name="ChevronRight" :size="16" class="muted account-chevron" />
</button>
</AnimatedSidebarFooter>
<AnimatedSidebarRail />
</AnimatedSidebar>
<AnimatedSidebarInset class="sidebar-inset">
<header class="inset-header">
<AnimatedSidebarTrigger class="inset-trigger"><LucideIcon name="PanelLeft" :size="16" /></AnimatedSidebarTrigger>
<div class="divider" />
<p class="active-title">{{ active }}</p>
</header>
<div class="inset-body">
<div>
<p class="date">Wednesday, July 29</p>
<h3 class="greeting">Good morning, {{ greeting }}.</h3>
<p class="intro">Your workspace stays in place while the navigation folds down to a focused icon rail.</p>
</div>
<div class="inset-foot">
<div>
<p class="foot-label">Active view</p>
<p class="foot-value">{{ active }}</p>
</div>
<p class="foot-hint">Press ⌘B to toggle</p>
</div>
</div>
</AnimatedSidebarInset>
</AnimatedSidebarProvider>
</div>
</template>
<style scoped>
.sidebar-demo { box-sizing: border-box; width: 100%; padding: .5rem 0; }
@media (min-width: 640px) { .sidebar-demo { padding: .75rem; } }
.sidebar-shell {
height: 720px; min-height: 0; overflow: hidden; border-radius: 1rem;
border: 1px solid color-mix(in srgb, var(--beui-foreground) 8%, transparent); background: var(--beui-background);
}
.sidebar-panel { min-height: 0; }
.sidebar-demo :deep(.be-asb-surface.sidebar-surface) { height: 100%; border-color: color-mix(in srgb, var(--beui-foreground) 8%, transparent); }
.sidebar-header { padding: .75rem; padding-bottom: .5rem; }
.brand-row { display: flex; align-items: center; gap: .75rem; min-height: 2.75rem; padding: 0 .5rem; overflow: hidden; }
.brand-mark { display: grid; flex-shrink: 0; place-items: center; width: 1.75rem; height: 1.75rem; border-radius: .5rem; background: var(--beui-foreground); color: var(--beui-background); }
.team-button {
display: flex; flex: 1 1 0%; align-items: center; gap: .5rem; min-width: 0; padding: 0; border: 0; border-radius: .5rem; background: transparent;
color: inherit; font: inherit; text-align: left; cursor: pointer; outline: none;
}
.team-button:focus-visible { box-shadow: 0 0 0 2px var(--beui-ring); }
.team-name { overflow: hidden; color: var(--beui-foreground); font-size: .875rem; line-height: 1.25rem; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.muted { flex-shrink: 0; color: var(--beui-muted-foreground); }
.sidebar-close { margin-left: auto; color: var(--beui-muted-foreground); }
.sidebar-close:hover { background: var(--beui-muted); }
@media (min-width: 768px) { .sidebar-close { display: none; } }
.sidebar-content { padding: .25rem .5rem 0; }
.group-first { padding-bottom: .5rem; }
.group-second { padding-top: .25rem; }
.sidebar-footer { gap: .75rem; padding: .75rem; border-top: 0; }
.account-button {
display: flex; align-items: center; gap: .75rem; box-sizing: border-box; width: 100%; min-height: 2.75rem; padding: .25rem; overflow: hidden;
border: 0; border-radius: .75rem; background: transparent; color: inherit; font: inherit; text-align: left; cursor: pointer; outline: none; transition: background-color .15s;
}
.account-button:hover { background: var(--beui-muted); }
.account-button:focus-visible { box-shadow: 0 0 0 2px var(--beui-ring); }
.avatar { display: grid; flex-shrink: 0; place-items: center; width: 2.25rem; height: 2.25rem; border-radius: 999px; background: #d5ff66; color: #172000; font-size: .75rem; line-height: 1rem; font-weight: 600; }
.account-text { flex: 1 1 0%; min-width: 0; }
.account-name, .account-email { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-name { color: var(--beui-foreground); font-size: .875rem; line-height: 1.25rem; font-weight: 500; }
.account-email { color: var(--beui-muted-foreground); font-size: .75rem; line-height: 1rem; }
/* The panel root carries data-state while it folds to the icon rail. */
.sidebar-demo :deep([data-slot=sidebar][data-state=collapsed]) .team-button,
.sidebar-demo :deep([data-slot=sidebar][data-state=collapsed]) .account-text,
.sidebar-demo :deep([data-slot=sidebar][data-state=collapsed]) .account-chevron { display: none; }
.sidebar-inset { min-height: 0; background: var(--beui-background); }
.inset-header { display: flex; flex-shrink: 0; align-items: center; gap: .75rem; height: 4rem; padding: 0 1rem; border-bottom: 1px solid var(--beui-border); }
.inset-trigger { color: var(--beui-muted-foreground); transition: color .15s, background-color .15s; }
.inset-trigger:hover { background: var(--beui-muted); color: var(--beui-foreground); }
.divider { width: 1px; height: 1.25rem; background: var(--beui-border); }
.active-title { margin: 0; color: var(--beui-foreground); font-size: .875rem; line-height: 1.25rem; font-weight: 500; }
.inset-body { display: flex; flex: 1 1 0%; flex-direction: column; justify-content: space-between; min-height: 0; padding: 1.25rem; overflow: hidden; }
@media (min-width: 640px) { .inset-body { padding: 1.75rem; } }
.date { margin: 0; color: var(--beui-muted-foreground); font-size: .75rem; line-height: 1rem; font-weight: 500; }
.greeting { max-width: 28rem; margin: .5rem 0 0; padding: 0; border: 0; color: var(--beui-foreground); font-size: 1.25rem; line-height: 1.75rem; font-weight: 600; letter-spacing: -.025em; }
@media (min-width: 640px) { .greeting { font-size: 1.5rem; line-height: 2rem; } }
.intro { max-width: 28rem; margin: .5rem 0 0; color: var(--beui-muted-foreground); font-size: .875rem; line-height: 1.5rem; }
.inset-foot { display: flex; align-items: flex-end; justify-content: space-between; padding-top: 1rem; border-top: 1px solid var(--beui-border); }
.foot-label { margin: 0; color: var(--beui-muted-foreground); font-size: 10px; text-transform: uppercase; letter-spacing: .16em; }
.foot-value { margin: .25rem 0 0; color: var(--beui-foreground); font-size: .875rem; line-height: 1.25rem; font-weight: 500; }
.foot-hint { display: none; margin: 0; color: var(--beui-muted-foreground); font-size: .75rem; line-height: 1rem; }
@media (min-width: 640px) { .foot-hint { display: block; } }
</style><script setup lang="ts">
import { computed, shallowRef } from 'vue'
import { type SidebarCollapsible, type SidebarDestination, type SidebarSide, type SidebarVariant } from './animated-sidebar/context'
import AnimatedSidebarClose from './animated-sidebar/AnimatedSidebarClose.vue'
import AnimatedSidebarContent from './animated-sidebar/AnimatedSidebarContent.vue'
import AnimatedSidebarFooter from './animated-sidebar/AnimatedSidebarFooter.vue'
import AnimatedSidebarGroup from './animated-sidebar/AnimatedSidebarGroup.vue'
import AnimatedSidebarGroupContent from './animated-sidebar/AnimatedSidebarGroupContent.vue'
import AnimatedSidebarHeader from './animated-sidebar/AnimatedSidebarHeader.vue'
import AnimatedSidebarInset from './animated-sidebar/AnimatedSidebarInset.vue'
import AnimatedSidebarMenu from './animated-sidebar/AnimatedSidebarMenu.vue'
import AnimatedSidebarMenuButton from './animated-sidebar/AnimatedSidebarMenuButton.vue'
import AnimatedSidebarMenuItem from './animated-sidebar/AnimatedSidebarMenuItem.vue'
import AnimatedSidebarMenuSub from './animated-sidebar/AnimatedSidebarMenuSub.vue'
import AnimatedSidebarMenuSubButton from './animated-sidebar/AnimatedSidebarMenuSubButton.vue'
import AnimatedSidebarMenuSubItem from './animated-sidebar/AnimatedSidebarMenuSubItem.vue'
import AnimatedSidebarPanel from './animated-sidebar/AnimatedSidebarPanel.vue'
import AnimatedSidebarProvider from './animated-sidebar/AnimatedSidebarProvider.vue'
import AnimatedSidebarRail from './animated-sidebar/AnimatedSidebarRail.vue'
import AnimatedSidebarTrigger from './animated-sidebar/AnimatedSidebarTrigger.vue'
/**
* With `items`: a zero-config shell, a sidebar built from the items with the page
* content in the default slot. Without `items`: the sidebar panel of the compound
* API (the upstream `AnimatedSidebar`), to be used inside `AnimatedSidebarProvider`
* next to `AnimatedSidebarInset`.
*/
defineOptions({ inheritAttrs: false })
const { items, label = 'Workspace', shortcut = true, collapsible = 'icon', side = 'left', variant = 'sidebar', ariaLabel, panelClassName } = defineProps<{
/** Builds the whole shell from data. Leave it out to compose the parts yourself. */
items?: readonly SidebarDestination[]
/** Accessible name of the shell in `items` mode. */
label?: string
shortcut?: boolean
collapsible?: SidebarCollapsible
/** Panel mode: which edge the sidebar sits on. */
side?: SidebarSide
/** Panel mode: surface style. */
variant?: SidebarVariant
/** Panel mode: accessible name of the sidebar. */
ariaLabel?: string
/** Panel mode: class of the sticky surface inside the width-animated wrapper. */
panelClassName?: string
}>()
const active = defineModel<string>()
const open = defineModel<boolean>('open', { default: true })
const openSection = shallowRef<string | null>(null)
function select(item: SidebarDestination) {
if (item.children?.length) openSection.value = openSection.value === item.id ? null : item.id
else openSection.value = null
active.value = item.id
}
</script>
<template>
<AnimatedSidebarPanel v-if="!items" v-bind="$attrs" :side="side" :variant="variant" :collapsible="collapsible" :aria-label="ariaLabel" :panel-class-name="panelClassName">
<slot />
</AnimatedSidebarPanel>
<AnimatedSidebarProvider v-else v-bind="$attrs" v-model:open="open" class="be-asb-shell" :shortcut="shortcut">
<AnimatedSidebarPanel :aria-label="label" :collapsible="collapsible" class="be-asb-shell-panel" panel-class="be-asb-shell-surface">
<AnimatedSidebarHeader>
<div class="be-asb-shell-head">
<slot name="header" :expanded="open"><strong class="be-asb-shell-title">{{ label }}</strong></slot>
<AnimatedSidebarClose class="be-asb-mobile-only"><span aria-hidden="true">×</span></AnimatedSidebarClose>
</div>
</AnimatedSidebarHeader>
<AnimatedSidebarContent>
<AnimatedSidebarGroup>
<AnimatedSidebarGroupContent>
<AnimatedSidebarMenu>
<AnimatedSidebarMenuItem v-for="item in items" :key="item.id">
<AnimatedSidebarMenuButton
:is-active="active === item.id || item.children?.some(child => child.id === active) === true" :label="item.label" :href="item.href"
:aria-expanded="item.children?.length ? openSection === item.id : undefined" :badge="item.badge" :disabled="item.disabled"
@select="select(item)"
>
<template #icon><slot name="icon" :item="item">{{ item.icon ?? item.label[0] }}</slot></template>
{{ item.label }}
</AnimatedSidebarMenuButton>
<AnimatedSidebarMenuSub v-if="item.children?.length" :open="openSection === item.id">
<AnimatedSidebarMenuSubItem v-for="child in item.children" :key="child.id">
<AnimatedSidebarMenuSubButton :is-active="active === child.id" :href="child.href" :disabled="child.disabled" @select="active = child.id">{{ child.label }}</AnimatedSidebarMenuSubButton>
</AnimatedSidebarMenuSubItem>
</AnimatedSidebarMenuSub>
</AnimatedSidebarMenuItem>
</AnimatedSidebarMenu>
</AnimatedSidebarGroupContent>
</AnimatedSidebarGroup>
</AnimatedSidebarContent>
<AnimatedSidebarFooter v-if="$slots.footer"><slot name="footer" :expanded="open" /></AnimatedSidebarFooter>
<AnimatedSidebarRail />
</AnimatedSidebarPanel>
<AnimatedSidebarInset class="be-asb-shell-inset">
<div class="be-asb-shell-bar"><AnimatedSidebarTrigger class="be-asb-shell-trigger"><span aria-hidden="true">◧</span></AnimatedSidebarTrigger></div>
<div class="be-asb-shell-main"><slot :active="active" :toggle="() => (open = !open)" /></div>
</AnimatedSidebarInset>
</AnimatedSidebarProvider>
</template>
<style>
.be-asb-shell { min-height: 22rem; overflow: hidden; border: 1px solid var(--beui-border); border-radius: 1rem; background: var(--beui-background); }
.be-asb-shell .be-asb-shell-surface { height: 100%; min-height: 22rem; }
.be-asb-shell .be-asb-shell-panel { min-height: 0; }
.be-asb-shell .be-asb-shell-inset { min-height: 0; }
.be-asb-shell-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; min-height: 2.75rem; padding: 0 .5rem; overflow: hidden; }
.be-asb-shell-title { font-size: .875rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.be-asb-shell-bar { display: flex; align-items: center; height: 4rem; padding: 0 1rem; border-bottom: 1px solid var(--beui-border); }
@media (min-width: 768px) { .be-asb-mobile-only { display: none; } }
.be-asb-shell-trigger { color: var(--beui-muted-foreground); }
.be-asb-shell-trigger:hover { background: var(--beui-muted); color: var(--beui-foreground); }
.be-asb-shell-main { flex: 1 1 0%; min-height: 0; padding: 1.25rem; }
</style>Install
Add it with your package manager, or copy the source manually.
Run it in a project set up with shadcn-vue. The source is copied to components/beui and its dependencies are added to your package.json. Read the shadcn-vue guide
$ bunx --bun shadcn-vue@latest add @beui-vue/animated-sidebar$ bun add beui-vueDownload the release archive to your project root, then install the local file.
$ bun add ./beui-vue-0.1.0.tgzImport the shared styles once in your application.
import AnimatedSidebar from '@/components/beui/layout/AnimatedSidebar.vue'
import '@/components/beui/styles.css'API Reference
AnimatedSidebarProvider
v-model:open?booleanDesktop open state. Leave unset for an uncontrolled sidebar.
undefineddefaultOpen?booleantruev-model:openMobile?booleanMobile sheet open state. Leave unset for an uncontrolled sheet.
undefineddefaultOpenMobile?booleanfalsestyle?StyleValue—labels?Partial<AnimatedSidebarMessages>Override any built-in string.
—class?string—shortcut?booleanCtrl/Cmd+B toggles the sidebar. Default true.
true@open-change?(open: boolean) => void—@open-mobile-change?(open: boolean) => void—AnimatedSidebarMenuSubButton
#icon?slotIcon before the label. Defaults to a small dot.
—href?string—isActive?booleanfalsedisabled?booleanfalsecloseOnSelect?booleantruetarget?SidebarLinkTarget—rel?string—@select?() => void—class?string—#default?slotLabel of the row.
—AnimatedSidebarMenuButton
#icon?slotIcon before the label. Stays visible in the icon rail.
—badge?stringTrailing text, for example a count. Hidden in the icon rail.
—href?string—isActive?booleanfalseariaExpanded?booleanMakes the row a disclosure button: the chevron shows and turns with this state.
undefineddisabled?booleanfalsecloseOnSelect?booleanundefinedtarget?SidebarLinkTarget—rel?string—@select?() => void—class?string—label?stringAccessible name and tooltip in the icon rail when the label is not plain text.
—#default?slotLabel of the row.
—#badge?slotTrailing content such as a count; replaces `badge`. Hidden in the icon rail.
—AnimatedSidebar
class?string—variant?SidebarVariantPanel mode: surface style.
sidebarside?SidebarSidePanel mode: which edge the sidebar sits on.
leftcollapsible?SidebarCollapsibleiconariaLabel?stringPanel mode: accessible name of the sidebar.
—panelClassName?stringPanel mode: class of the sticky surface inside the width-animated wrapper.
—items?readonly SidebarDestination[]Builds the whole shell from data. Leave it out to compose the parts yourself.
—label?stringAccessible name of the shell in `items` mode.
Workspaceshortcut?booleantruev-model?string—v-model:open?booleantrueAnimatedSidebarTrigger
class?string—ariaLabel?string—@click?(event: MouseEvent) => void—AnimatedSidebarClose
class?string—ariaLabel?string—@click?(event: MouseEvent) => void—AnimatedSidebarRail
class?string—ariaLabel?string—@click?(event: MouseEvent) => void—AnimatedSidebarInset
class?string—AnimatedSidebarHeader
class?string—AnimatedSidebarContent
class?string—AnimatedSidebarFooter
class?string—AnimatedSidebarGroup
class?string—AnimatedSidebarGroupLabel
class?string—AnimatedSidebarGroupContent
class?string—AnimatedSidebarMenu
class?string—AnimatedSidebarMenuItem
class?string—AnimatedSidebarMenuSub
class?string—openboolean—AnimatedSidebarMenuSubItem
class?string—Composition
Compose navigation groups inside the sidebar and place the application surface in the sibling inset.
AnimatedSidebarProvider
├── AnimatedSidebar
│ ├── AnimatedSidebarHeader
│ ├── AnimatedSidebarContent
│ │ └── AnimatedSidebarMenu
│ ├── AnimatedSidebarFooter
│ └── AnimatedSidebarRail
└── AnimatedSidebarInsetNote: AI Sidebar composes the shell with editable projects, folders, files, and bookmarks.
How it works
An application sidebar is the responsive shell around persistent navigation. It coordinates desktop collapse, mobile presentation, nested destinations, and the content inset without owning the data rendered inside those regions.
Related components
Dropdown Menu
Composable dropdown menu that opens from its trigger, with a gliding highlight, submenus that stay open on a diagonal path, checkbox and radio items, shortcuts and full keyboard support.
Image Viewer
A composable Vue image viewer for galleries and attachment previews, with animated lightbox variants, custom thumbnails and controls, swipe and keyboard navigation, zoom and pan, accessible focus management, and controlled or uncontrolled selection.
Combobox
Searchable combobox with a morphing portal, grouped filtering, keyboard navigation, and controlled or uncontrolled state.
Updated