Sidebar Adaptive
Adaptive navigation: a full glass sidebar with brand, gradient action button, labelled links and a usage meter on desktop; a floating bottom tab bar with a raised gradient “+” on mobile.
glass/layout/sidebar-adaptiveSource
"use client";
import type { ReactNode } from "react";
import { BarChart3, CalendarDays, Home, Plus, Sparkles, Video, type LucideIcon } from "lucide-react";
import { cn } from "@/lib/utils";
export interface SidebarAdaptiveItem {
label: string;
href: string;
icon: LucideIcon;
}
export interface SidebarAdaptiveProps {
brand?: string;
items?: SidebarAdaptiveItem[];
activeHref?: string;
/** Primary action (big “+” on mobile, full button on desktop). */
action?: { label: string; href: string };
usage?: { used: number; total: number; label: string };
children?: ReactNode;
className?: string;
}
const GLASS = "da-stroke bg-da-surface backdrop-blur-da backdrop-saturate-150";
const DEFAULT_ITEMS: SidebarAdaptiveItem[] = [
{ label: "Home", href: "#home", icon: Home },
{ label: "Meetings", href: "#meetings", icon: Video },
{ label: "Calendar", href: "#calendar", icon: CalendarDays },
{ label: "Insights", href: "#insights", icon: BarChart3 },
];
/** Adaptive navigation: a full glass sidebar with labels, action button and usage meter on desktop; a bottom tab bar with a raised center “+” on mobile. */
export function SidebarAdaptive({
brand = "Halo",
items = DEFAULT_ITEMS,
activeHref = "#home",
action = { label: "Record a video", href: "#record" },
usage = { used: 42, total: 50, label: "recaps this month" },
children,
className,
}: SidebarAdaptiveProps) {
const half = Math.ceil(items.length / 2);
const tab = (it: SidebarAdaptiveItem) => {
const active = it.href === activeHref;
return (
<a
key={it.href}
href={it.href}
aria-current={active ? "page" : undefined}
className={cn(
"da-focus flex flex-1 flex-col items-center gap-1 rounded-da-md py-1.5 text-[11px] font-medium",
active ? "text-da-primary" : "text-da-muted-fg",
)}
>
<it.icon aria-hidden className="size-5" />
{it.label}
</a>
);
};
return (
<div className={cn("min-h-dvh text-da-fg lg:flex", className)}>
<aside className="hidden p-4 lg:block">
<div className={cn("sticky top-4 flex h-[calc(100dvh-2rem)] w-64 flex-col rounded-da-lg p-4 shadow-da-lg", GLASS)}>
<p className="flex items-center gap-2 px-2 font-da-display text-lg font-semibold">
<span aria-hidden className="size-7 rounded-full bg-gradient-to-br from-da-primary to-da-accent" />
{brand}
</p>
<a
href={action.href}
className="da-focus da-transition mt-6 flex h-11 items-center justify-center gap-2 rounded-da-pill bg-gradient-to-r from-da-primary to-da-accent font-semibold text-da-primary-fg shadow-da-md hover:-translate-y-0.5"
>
<Plus aria-hidden className="size-4" /> {action.label}
</a>
<nav aria-label="Main" className="mt-6 flex-1 space-y-1">
{items.map((it) => {
const active = it.href === activeHref;
return (
<a
key={it.href}
href={it.href}
aria-current={active ? "page" : undefined}
className={cn(
"da-focus da-transition flex h-11 items-center gap-3 rounded-da-md px-3 text-[15px] font-medium",
active ? "bg-da-surface text-da-fg shadow-da-sm" : "text-da-muted-fg hover:bg-da-surface-2 hover:text-da-fg",
)}
>
<it.icon aria-hidden className={cn("size-5", active && "text-da-primary")} />
{it.label}
</a>
);
})}
</nav>
<div className="rounded-da-md bg-da-surface-2 p-4">
<p className="flex items-center gap-1.5 text-xs font-semibold">
<Sparkles aria-hidden className="size-3.5 text-da-primary" /> {usage.used} / {usage.total} {usage.label}
</p>
<div
className="mt-2 h-2 overflow-hidden rounded-full bg-da-muted"
role="progressbar"
aria-valuenow={usage.used}
aria-valuemax={usage.total}
aria-label={usage.label}
>
<div className="h-full rounded-full bg-gradient-to-r from-da-primary to-da-accent" style={{ width: `${(usage.used / usage.total) * 100}%` }} />
</div>
<a href="#upgrade" className="da-focus mt-3 inline-block rounded-da-sm text-xs font-semibold text-da-primary hover:underline">
Upgrade for unlimited
</a>
</div>
</div>
</aside>
<main className="min-w-0 flex-1 pb-28 lg:pb-0">{children}</main>
<nav aria-label="Main" className={cn("fixed inset-x-3 bottom-3 z-30 flex items-center rounded-da-lg px-2 py-1.5 shadow-da-lg lg:hidden", GLASS)}>
{items.slice(0, half).map(tab)}
<a
href={action.href}
aria-label={action.label}
className="da-focus -mt-8 grid size-14 shrink-0 place-items-center rounded-full bg-gradient-to-br from-da-primary to-da-accent text-da-primary-fg shadow-da-lg ring-4 ring-da-bg"
>
<Plus aria-hidden className="size-6" />
</a>
{items.slice(half).map(tab)}
</nav>
</div>
);
}
export default SidebarAdaptive;
modules/glass/layout/sidebar-adaptive/index.tsx
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| brand | string | — | Brand. |
| items | { label, href, icon }[] | — | Links (split around the + on mobile). |
| activeHref | string | — | Current page. |
| action | { label, href } | — | Primary action. |
| usage | { used, total, label } | — | Meter. |
| children | ReactNode | — | Content. |
| className | string | — | Classes. |
Other sidebar variants in Glass
App Sidebar
Floating frosted sidebar inset from the viewport edges: gradient-orb brand, pill nav items with an ink active state and gradient badges, workspace group, gradient promo card and user chip. Becomes a floating pill top bar + glass drawer below lg.
Sidebar Channels
Chat-app style double sidebar: a column of gradient workspace squircles plus a glass channel panel with collapsible sections, private/live icons, unread counts and LIVE meeting badges; drawer on mobile.
Sidebar Floating
Floating glass icon rail detached from the viewport edges: gradient logo orb, gradient active item, unread badges, glass tooltips on hover/focus, settings and avatar at the bottom; a floating bottom bar on mobile.
Sidebar in other art directions
App Sidebar
App shell with a sticky left sidebar: workspace header, grouped nav with yellow active state and counters, usage meter, user footer. Becomes a top bar + slide-over drawer below lg.
Icon Rail
Compact 80px icon rail: ink brand square, square icon links with yellow active state, red counters and ink tooltips on hover/focus, settings pinned at the bottom. Server-safe, CSS-only tooltips.
Sidebar Collapsible
App sidebar that collapses from 256px to a 76px icon column with a stepped width animation; ink active item, labels become sr-only when collapsed, collapse toggle pinned at the bottom.
Sidebar Dual
Two-level navigation: an ink icon rail switches sections, and a paper second panel lists that section's links with counts and a yellow active link. Second panel hides on very small screens.
App Sidebar
Linear-style app shell: 240px translucent sidebar with workspace switcher, search, "New" button with shortcut, grouped 32px nav rows with counters, team list with color squares and settings at the bottom. Slide-in drawer below lg.
Sidebar Inset
Inset app shell: the sidebar sits on the tinted page background while content lives in a raised rounded panel. Workspace header, collapsible nested sections with guide line, support/settings and user card; drawer on mobile.
Sidebar Rail
Sidebar that collapses between a 224px labelled list and a 56px icon rail (⌘B or bottom button) with tooltips on hover/focus and corner badges; icon-only on mobile. Controlled or uncontrolled.
Sidebar Tree
Docs / settings sidebar with a filter box and a nested collapsible tree auto-expanded to the active page (highlighted in indigo); stacks above content on mobile.
App Sidebar
Typographic app sidebar: hairline right border, logo + site switcher, mono group labels, plain text links with right-aligned mono counts; the active link is ink with a signal dot; drawer on mobile.
Sidebar Icons
Narrow icon rail (56px) of square hairline cells; the active cell is filled ink; labels appear as mono tooltips to the right on hover/focus; turns into a bottom bar on mobile.
Sidebar Ink
Ink sidebar (stays near-black in dark mode): giant numbered text links “01 Overview”, the active one full white with an arrow, a storage meter as a hairline bar at the bottom; drawer on mobile.
Sidebar Tree
CMS page tree: nested pages drawn with hairline guide lines and +/− toggles (aria-expanded), mono “Pages” header with an add button; active page ink with signal dot; drawer on mobile.
App Sidebar
Classic enterprise app shell: white bordered sidebar with brand, entity switcher, grouped nav (uppercase group labels, count badges, blue active state), settings and user footer; off-canvas drawer on mobile.
Sidebar Collapsible
Sidebar that collapses from 240px to a 64px icon rail with a toggle button (aria-expanded); collapsed items keep tooltips (title) and sr-only labels. Always a rail on small screens.
Sidebar Dual
Two-level navigation: a narrow icon rail of top-level sections (tooltips, aria-pressed) and a secondary panel listing the selected section’s pages; the panel hides below md.
Sidebar Navy
Dark navy sidebar (fg-colored in light mode, surface in dark mode — dark in both): brand, search field, nav with white-tint active state and badges, and a cash-balance card at the bottom; drawer on mobile.
App Sidebar
Calm app shell: cream sidebar with leaf logo, pill nav items (sage pill for the active page), a small “this year” footprint card with a sprout, and settings at the bottom; drawer on mobile.
Sidebar Floating
Floating sidebar: a rounded cream panel inset from the page edges with a soft shadow, italic serif group labels, a sage “New entry” pill and sage-tinted active items; drawer on mobile.
Sidebar Garden
Deep sage sidebar (dark sage tint in dark mode) with cream text, a translucent active pill, count bubbles, rolling hills illustrated along the bottom and the user’s name on the hill; drawer on mobile.
Sidebar Rail
Slim round icon rail: circular icon links on a sand column, the active one a sage circle with a leaf-shaped marker; labels appear as soft tooltips on hover/focus; becomes a bottom tab bar on mobile.
App Sidebar
Friendly app shell: warm sidebar with emoji workspace chip, big periwinkle “New task” pill, search field, nav with peach count bubbles and a colored-dot board list; slide-in drawer on mobile.
Sidebar Boards
Board navigator: starred favorites, then collapsible emoji spaces holding emoji boards with count bubbles; active board in a white pill; dashed “New space” button.
Sidebar Card
Floating white sidebar card with generous radius on a tinted page: two-dot logo, nav with lavender active pill, butter “tip of the day” card and user row; horizontal nav on mobile.
Sidebar Rail
Slim rounded icon rail: round icons whose active item fills with its own pastel color, dark pill tooltips, emoji avatar at the bottom; floating bottom bar on mobile.