All blocks
[22] App
Sidebar With Workspace Switcher
A workspace menu on top, links with counts, a projects group and the signed-in account at the bottom.
1280px
Copy the code
One file with one component and its sample data. It needs @vaneui/ui and its stylesheet, set up as in the installation guide.
sidebar-workspace.tsx
import type { ReactNode } from "react";import { Avatar, Badge, Button, Col, Divider, Icon, IconButton, Menu, MenuItem, MenuLabel, NavLink, PageTitle, Row, Stack, Text } from "@vaneui/ui";
function Svg({ children }: { children: ReactNode }) { return ( <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true"> {children} </svg> );}
const main = [ { href: "/inbox", label: "Inbox", count: 4, icon: <Svg><path d="M3 13h5l2 3h4l2-3h5M5 5h14l2 8v6H3v-6z" /></Svg> }, { href: "/my-tasks", label: "My tasks", count: 12, icon: <Svg><path d="m4 12 4 4 8-8M14 18h6" /></Svg> }, { href: "/projects", label: "Projects", icon: <Svg><rect x="3" y="4" width="7" height="16" rx="1" /><rect x="14" y="4" width="7" height="10" rx="1" /></Svg> }, { href: "/docs", label: "Docs", icon: <Svg><path d="M7 3h7l5 5v13H7z" /><path d="M14 3v5h5" /></Svg> },];const projects = [ { href: "/projects/website", label: "Website relaunch", tone: { info: true } }, { href: "/projects/mobile", label: "Mobile app", tone: { success: true } }, { href: "/projects/q1-planning", label: "Q1 planning", tone: { warning: true } },];const workspaces = ["Acme Inc", "Northwind", "Personal"];
const ChevronsIcon = () => <Svg><path d="m8 9 4-4 4 4M8 15l4 4 4-4" /></Svg>;const MoreIcon = () => <Svg><circle cx="5" cy="12" r="1" /><circle cx="12" cy="12" r="1" /><circle cx="19" cy="12" r="1" /></Svg>;
export function SidebarWorkspace({ current = "/inbox" }: { current?: string }) { return ( <Row noGap itemsStretch className="min-h-dvh"> <Col tag="nav" aria-label="Main" justifyBetween borderR padding noShrink mobileWFull className="w-64"> <Col> <Menu trigger={ <Button ghost secondary wFull justifyBetween> <Row sm> <Avatar sm rounded name="Acme" alt="" /> <Text tag="span" sm fontSemibold>Acme Inc</Text> </Row> <ChevronsIcon /> </Button> }> <MenuLabel>Workspaces</MenuLabel> {workspaces.map((w) => ( <MenuItem key={w} aria-current={w === "Acme Inc" ? "true" : undefined}>{w}</MenuItem> ))} <Divider /> <MenuItem>Create a workspace</MenuItem> </Menu> <Col noGap> {main.map((item) => ( <NavLink key={item.href} href={item.href} active={item.href === current}> {item.icon} {item.label} {item.count !== undefined && <Badge aria-label={`${item.count} new`}>{item.count}</Badge>} </NavLink> ))} </Col> <Col xs> <Text xs fontSemibold tertiary className="px-3">Projects</Text> <Col noGap> {projects.map((p) => ( <NavLink key={p.href} href={p.href} active={p.href === current}> <Icon sm {...p.tone}><svg viewBox="0 0 24 24"><circle cx="12" cy="12" r="5" fill="currentColor" /></svg></Icon> {p.label} </NavLink> ))} </Col> </Col> </Col> <Row justifyBetween borderT paddingY> <Row sm className="min-w-0"> <Avatar sm name="Ana Diaz" alt="" /> <Col noGap className="min-w-0"> <Text sm fontMedium truncate>Ana Diaz</Text> <Text xs tertiary truncate>ana@acme.com</Text> </Col> </Row> <Menu trigger={<IconButton ghost secondary aria-label="Account menu"><MoreIcon /></IconButton>}> <MenuItem href="/settings/profile">Profile</MenuItem> <MenuItem href="/settings">Settings</MenuItem> <Divider /> <MenuItem>Sign out</MenuItem> </Menu> </Row> </Col> <Stack tag="main" flex1 mobileHide className="min-w-0"> <PageTitle>Inbox</PageTitle> <Text secondary>4 unread updates from your projects.</Text> </Stack> </Row> );}Components in this block
Adapt it with your coding agent
Add the VaneUI MCP server, and your agent reads the component docs and prop tables while it changes the block: the copy, the sample data or the layout.
$ claude mcp add vaneui -- npx -y @vaneui/mcp
Setup for other editors is in the AI assistants guide.