Sidebar with Submenus

A sidebar with collapsible sections and nested submenu items.

Sidebar
Collapsible
Avatar
Dropdown Menu

Preview

Code

<BbSidebarProvider>
    <BbSidebar>
        <BbSidebarHeader>
            <div class="flex items-center gap-2 px-2 h-10">
                <div class="flex h-7 w-7 items-center justify-center rounded-md bg-primary text-primary-foreground">
                    <LucideIcon Name="command" class="h-4 w-4" />
                </div>
                <span class="text-sm font-semibold">Acme Inc.</span>
            </div>
        </BbSidebarHeader>
        <BbSidebarContent>
            <BbSidebarGroup>
                <BbSidebarGroupLabel>Platform</BbSidebarGroupLabel>
                <BbSidebarMenu>
                    <BbSidebarMenuItem>
                        <BbCollapsible DefaultOpen="true">
                            <BbSidebarMenuButton>
                                <LucideIcon Name="terminal" class="h-4 w-4" />
                                <span>Playground</span>
                                <LucideIcon Name="chevron-right" class="ml-auto h-4 w-4" />
                            </BbSidebarMenuButton>
                            <BbCollapsibleContent>
                                <BbSidebarMenuSub>
                                    <BbSidebarMenuSubItem>
                                        <BbSidebarMenuSubButton Href="/playground/history" IsActive="true">
                                            <span>History</span>
                                        </BbSidebarMenuSubButton>
                                    </BbSidebarMenuSubItem>
                                    <BbSidebarMenuSubItem>
                                        <BbSidebarMenuSubButton Href="/playground/starred">
                                            <span>Starred</span>
                                        </BbSidebarMenuSubButton>
                                    </BbSidebarMenuSubItem>
                                    <BbSidebarMenuSubItem>
                                        <BbSidebarMenuSubButton Href="/playground/settings">
                                            <span>Settings</span>
                                        </BbSidebarMenuSubButton>
                                    </BbSidebarMenuSubItem>
                                </BbSidebarMenuSub>
                            </BbCollapsibleContent>
                        </BbCollapsible>
                    </BbSidebarMenuItem>
                    <!-- More items... -->
                </BbSidebarMenu>
            </BbSidebarGroup>
        </BbSidebarContent>
        <BbSidebarFooter>
            <BbDropdownMenu>
                <BbDropdownMenuTrigger>
                    <BbButton Variant="ButtonVariant.Ghost" Class="w-full justify-start gap-2 px-2 h-10">
                        <BbAvatar Size="AvatarSize.Small">
                            <BbAvatarFallback>AJ</BbAvatarFallback>
                        </BbAvatar>
                        <div class="flex flex-col items-start text-left flex-1 min-w-0">
                            <span class="text-sm font-medium truncate">Alex Johnson</span>
                            <span class="text-xs text-muted-foreground truncate">[email protected]</span>
                        </div>
                        <LucideIcon Name="chevrons-up-down" class="h-4 w-4 text-muted-foreground" />
                    </BbButton>
                </BbDropdownMenuTrigger>
                <BbDropdownMenuContent Side="PopoverSide.Top" Align="PopoverAlign.Start" MatchTriggerWidth="true">
                    <BbDropdownMenuLabel>My Account</BbDropdownMenuLabel>
                    <BbDropdownMenuSeparator />
                    <BbDropdownMenuItem>Profile</BbDropdownMenuItem>
                    <BbDropdownMenuItem>Billing</BbDropdownMenuItem>
                    <BbDropdownMenuItem>Notifications</BbDropdownMenuItem>
                    <BbDropdownMenuSeparator />
                    <BbDropdownMenuItem>Log out</BbDropdownMenuItem>
                </BbDropdownMenuContent>
            </BbDropdownMenu>
        </BbSidebarFooter>
    </BbSidebar>
    <BbSidebarInset>
        <!-- Your content here -->
    </BbSidebarInset>
</BbSidebarProvider>