Glass Sidebar for React
A glass sidebar navigation for React with grouped items, icons and counts that collapses into an icon rail with tooltips.
npx shadcn@latest add https://lokendra-builds.github.io/sheenui/r/vertical-nav.json3 reviews waiting.
VerticalNavdefaultVerticalNavLabels
Sidebar and icon rail
Click items to watch the highlight slide; toggle the rail. On a phone, collapse it to see the page beside it.
Inbox
import { useState } from "react";
import { Avatar } from "@/components/sheenui/avatar/avatar";
import { GlassCard } from "@/components/sheenui/glass-card/glass-card";
import { SheenLogo } from "@/components/sheenui/logo/logo";
import { VerticalNav, type VerticalNavSection } from "@/components/sheenui/vertical-nav/vertical-nav";
// Package build (after the first npm release, or a packed tarball): import { Avatar, GlassCard, SheenLogo, VerticalNav, type VerticalNavSection } from "@sheenui/theme";
// This example also uses avatar, glass-card, logo: npx shadcn@latest add https://lokendra-builds.github.io/sheenui/r/avatar.json https://lokendra-builds.github.io/sheenui/r/glass-card.json https://lokendra-builds.github.io/sheenui/r/logo.json
// Inline 24px line icons: use any icon set (for example lucide-react) instead.
const icon = (d: string) => (
<svg aria-hidden viewBox="0 0 24 24" className="size-[1.1rem]" fill="none" stroke="currentColor" strokeWidth="1.8" strokeLinecap="round" strokeLinejoin="round">
<path d={d} />
</svg>
);
const sections: VerticalNavSection[] = [
{
title: "Workspace",
items: [
{ value: "home", label: "Home", icon: icon("M3 11l9-7 9 7v9a1 1 0 0 1-1 1h-5v-6h-6v6H4a1 1 0 0 1-1-1z") },
{ value: "inbox", label: "Inbox", icon: icon("M3 13h5l1.5 3h5L16 13h5M5 5h14l2 8v6H3v-6z"), badge: 12 },
{ value: "projects", label: "Projects", icon: icon("M3 7h7l2 2h9v10H3z") },
{ value: "analytics", label: "Analytics", icon: icon("M4 20V10M10 20V4M16 20v-7M22 20H2") },
],
},
{
title: "Account",
items: [
{ value: "team", label: "Team", icon: icon("M16 19v-1a4 4 0 0 0-8 0v1M12 11a3 3 0 1 0 0-6 3 3 0 0 0 0 6M20 19v-1a3 3 0 0 0-3-3M17 5.5a3 3 0 0 1 0 5") },
{ value: "billing", label: "Billing", icon: icon("M3 6h18v12H3zM3 10h18") },
{ value: "settings", label: "Settings", icon: icon("M12 15a3 3 0 1 0 0-6 3 3 0 0 0 0 6M19 12l2-1-2-4-2 .5-1.5-1.5.5-2-4-2-1 2h-2l-1-2-4 2 .5 2L5 6.5 3 7l-2 4 2 1v2l-2 1 2 4 2-.5 1.5 1.5-.5 2 4 2 1-2h2l1 2 4-2-.5-2 1.5-1.5 2 .5 2-4-2-1z") },
],
},
];
const labels = Object.fromEntries(sections.flatMap((s) => s.items.map((item) => [item.value, item.label])));
export function Example() {
const [value, setValue] = useState("inbox");
const [collapsed, setCollapsed] = useState(false);
return (
<div className="flex gap-4">
<VerticalNav
aria-label="Workspace"
collapsed={collapsed}
header={<SheenLogo px={28} variant={collapsed ? "mark" : "full"} glow={false} />}
sections={sections}
value={value}
onValueChange={setValue}
footer={
<div className="flex items-center gap-2.5 px-1">
<Avatar name="Ada Lovelace" size="sm" status="online" />
{!collapsed && (
<span className="min-w-0">
<span className="block truncate text-sm font-medium">Ada</span>
<span className="block truncate text-xs text-sheen-fg-muted">Pro plan</span>
</span>
)}
</div>
}
/>
<GlassCard level={2} sheen={false} className="min-w-0 flex-1 self-start px-5 py-4">
<h3 className="text-lg font-semibold tracking-tight">{labels[value]}</h3>
<button onClick={() => setCollapsed((c) => !c)}>Toggle icon rail</button>
</GlassCard>
</div>
);
}Files to copy
8 folders · 8 files · 4 packages
- From
theme/src/ components/vertical-nav/components/drawer/parts/sheet.tsxcomponents/navbar/components/popover/hooks/{use-latest.ts, use-media-query.ts, use-preferences.ts}motion/tokens.tslib/{cn.ts, form.ts, popup-motion.ts}styles/
- shadcn CLI
npx shadcn@latest add https://lokendra-builds.github.io/sheenui/r/vertical-nav.jsonRegistry item: vertical-nav. The styles need the Tailwind v4 glass UI setup.- The examples also use
components/avatar/components/glass-card/components/logo/motion/light-follower.tslib/{heading.ts, initials.ts}
npx shadcn@latest add https://lokendra-builds.github.io/sheenui/r/avatar.json https://lokendra-builds.github.io/sheenui/r/glass-card.json https://lokendra-builds.github.io/sheenui/r/logo.json- Packages
pnpm add @base-ui/react clsx motion tailwind-merge
Text only, for settings
Icons, titles and the header are all optional. A badge still counts things to look at.
import { useState } from "react";
import { VerticalNav } from "@/components/sheenui/vertical-nav/vertical-nav";
// Package build (after the first npm release, or a packed tarball): import { VerticalNav } from "@sheenui/theme";
export function Example() {
const [value, setValue] = useState("profile");
return (
<VerticalNav
aria-label="Settings"
value={value}
onValueChange={setValue}
sections={[
{
items: [
{ value: "profile", label: "Profile" },
{ value: "security", label: "Security" },
{ value: "notifications", label: "Notifications", badge: 3 },
{ value: "billing", label: "Billing" },
],
},
]}
/>
);
}Props
Keyboard
Accessibility
- A <nav> with a list; the current item has aria-current="page". Name the nav with aria-label.
- In the icon rail every item keeps its text as an accessible name and shows it in a tooltip on hover and focus.
- Under reduced motion the rail snaps open and shut in one frame.
All exports on this page
VerticalNav— Vertical (sidebar) navigation on glass.defaultVerticalNavLabels— The English VerticalNavLabels used when labels is omitted; a partial labels prop is merged over it.
When to use the vertical nav
- Use it as a React sidebar for an admin dashboard, with Workspace and Account sections, icons on every row and an unread badge on Inbox, so people can reach any screen in one click.
- Use it for a settings page where Profile, Security, Notifications and Billing sit in a narrow column beside the form, with no icons or section titles needed.
- The collapsed prop turns it into an icon-only rail, which suits apps where the content area needs the width on small laptops but power users still want one-click navigation.
- Skip it when the navigation has only a few top-level destinations and lives across the top of the page; Horizontal nav fits there, and Tabs fits switching views inside a single page.
- Pair it with Avatar in the footer slot for the signed-in user, SheenLogo in the header, and Tooltip behavior already built in for the collapsed rail.
Frequently asked questions
Related pages
67 components pages in all: browse them on All components.
By Lokendra Singh Rathore (GitHub, opens in a new tab). Published , updated .