App Topbar with Multi-Stop Theme & Accent Picker
MSAI app topbar separating global room brightness (4 hand-tuned stops: Midnight, Dim, Paper, Bright) from per-workspace accent hue (13 swatches + custom picker), paired with a live credits balance pill and global Help-mode switch.
Install UI SDK & packages
npm install @ui-sdk/react @ui-sdk/core lucide-react
Give your agent the UI SDK skill
npx skills add vercel-labs/ui --skill ui-sdk
"use client"; import * as React from "react"; import { Check, ChevronLeft, Lightbulb, Moon, Palette, Search, Sun, Zap, } from "lucide-react"; import { Button } from "@ui-sdk/react/button"; import { Popover, PopoverContent, PopoverTrigger } from "@ui-sdk/react/popover"; import { Switch } from "@ui-sdk/react/switch"; export const THEME_STOPS = [ { id: 0, name: "Midnight", brightness: 0.1 }, { id: 1, name: "Dim", brightness: 0.35 }, { id: 2, name: "Paper", brightness: 0.8 }, { id: 3, name: "Bright", brightness: 1.0 }, ] as const; export const ACCENT_SWATCHES = [ "#3E8BFF", "#6366F1", "#8B6CFF", "#A855F7", "#E23F9E", "#F43F5E", "#E86A6A", "#F97316", "#E8B54A", "#84CC16", "#2FD565", "#14B8A6", "#22B8CF", ]; export interface WorkspaceThemeBarProps { themeStop?: number; onThemeStopChange?: (stop: number) => void; accentHex?: string; onAccentChange?: (hex: string) => void; helpMode?: boolean; onHelpModeChange?: (on: boolean) => void; creditsBalance?: number; onBack?: () => void; onSearchOpen?: () => void; } /** * MSAI insight: split global room brightness (4 hand-tuned stops) from workspace identity * (accent hue). Switching workspaces recolors the UI instead of relighting the whole room. */ export function WorkspaceThemeBar({ themeStop = 0, onThemeStopChange, accentHex = "#3E8BFF", onAccentChange, helpMode = false, onHelpModeChange, creditsBalance = 2240, onBack, onSearchOpen, }: WorkspaceThemeBarProps) { const stop = THEME_STOPS[Math.max(0, Math.min(THEME_STOPS.length - 1, themeStop))]; const isPreset = ACCENT_SWATCHES.some((h) => h.toLowerCase() === accentHex.toLowerCase()); return ( <header className="flex h-14 w-full items-center justify-between gap-3 border-b border-slate-200 bg-white/90 px-4 backdrop-blur-md dark:border-slate-800 dark:bg-[#0e1422]/90"> <div className="flex items-center gap-2"> <Button name="Go back" variant="ghost" onClick={onBack} className="inline-flex h-8 items-center gap-1 rounded-lg px-2.5 text-xs font-semibold text-slate-500 hover:bg-slate-100 hover:text-slate-900 dark:text-slate-400 dark:hover:bg-slate-800 dark:hover:text-white" > <ChevronLeft className="h-4 w-4" /> Back </Button> </div> <div className="flex items-center gap-2"> <Popover name="Credits balance"> <PopoverTrigger asChild> <button type="button" className="inline-flex h-8 cursor-pointer items-center gap-1.5 rounded-full border border-slate-200 bg-slate-50 px-3 text-xs font-bold tabular-nums text-slate-800 transition hover:border-slate-300 dark:border-slate-700 dark:bg-[#162033] dark:text-slate-100" > <Zap className="h-3.5 w-3.5 text-amber-400" /> <span>{creditsBalance.toLocaleString()}</span> <span className="font-medium text-slate-400">credits</span> </button> </PopoverTrigger> <PopoverContent align="end" className="w-64 p-3.5"> <div className="text-lg font-extrabold tabular-nums">{creditsBalance.toLocaleString()}</div> <p className="text-xs text-slate-500 dark:text-slate-400">Shared team pool</p> </PopoverContent> </Popover> <label className="inline-flex h-8 cursor-pointer items-center gap-2 rounded-full border border-slate-200 bg-slate-50 px-2.5 text-xs font-semibold text-slate-700 dark:border-slate-700 dark:bg-[#162033] dark:text-slate-200"> <Lightbulb className="h-3.5 w-3.5 text-amber-400" /> <span>Help</span> <Switch name="Help mode" checked={helpMode} onCheckedChange={(v) => onHelpModeChange?.(Boolean(v))} /> </label> <Popover name="Theme & workspace color"> <PopoverTrigger asChild> <button type="button" aria-label={`Theme — ${stop.name}`} className="grid h-8 w-8 cursor-pointer place-items-center rounded-lg border border-slate-200 bg-slate-50 text-slate-700 hover:border-slate-300 dark:border-slate-700 dark:bg-[#162033] dark:text-slate-200" > {stop.brightness > 0.5 ? <Sun className="h-4 w-4" /> : <Moon className="h-4 w-4" />} </button> </PopoverTrigger> <PopoverContent align="end" className="w-72 space-y-4 p-4"> <div className="space-y-2"> <div className="flex items-center justify-between text-xs"> <span className="font-semibold text-slate-500 dark:text-slate-400">Theme</span> <span className="font-bold">{stop.name}</span> </div> <input type="range" min={0} max={THEME_STOPS.length - 1} step={1} value={stop.id} aria-label="Brightness stop" onChange={(e) => onThemeStopChange?.(Number(e.target.value))} className="w-full accent-sky-500" /> </div> <div className="space-y-2 border-t border-slate-200 pt-3 dark:border-slate-800"> <span className="block text-xs font-semibold text-slate-500 dark:text-slate-400"> Workspace color </span> <div className="grid grid-cols-7 gap-2"> {ACCENT_SWATCHES.map((hex) => { const on = hex.toLowerCase() === accentHex.toLowerCase(); return ( <button key={hex} type="button" aria-label={`Set workspace color ${hex}`} aria-pressed={on} onClick={() => onAccentChange?.(hex)} style={{ backgroundColor: hex }} className={`grid h-7 w-7 cursor-pointer place-items-center rounded-full text-white transition ${ on ? "ring-2 ring-white ring-offset-2 ring-offset-slate-900" : "hover:scale-105" }`} > {on && <Check className="h-3.5 w-3.5" />} </button> ); })} <label title="Custom color" style={{ backgroundColor: isPreset ? "transparent" : accentHex }} className="grid h-7 w-7 cursor-pointer place-items-center rounded-full border border-dashed border-slate-400 text-slate-500" > <Palette className="h-3.5 w-3.5" /> <input type="color" value={accentHex} onChange={(e) => onAccentChange?.(e.target.value)} className="sr-only" /> </label> </div> </div> </PopoverContent> </Popover> <button type="button" aria-label="Search" onClick={onSearchOpen} className="grid h-8 w-8 cursor-pointer place-items-center rounded-lg border border-slate-200 bg-slate-50 text-slate-700 hover:border-slate-300 dark:border-slate-700 dark:bg-[#162033] dark:text-slate-200" > <Search className="h-4 w-4" /> </button> </div> </header> ); } export default WorkspaceThemeBar;
More in Navigation & Shells
Nested Workspace & Docked Section Nav
Two-column app navigation shell extracted from MSAI: a collapsible left rail with workspace switcher, primary nav, time-bucketed scheduled items, and expandable project folders beside a docked Level-1/Level-2 SectionNav column that folds down to a clickable 11px edge strip.
Collapsible App Workspace Shell
Full-height app workspace that never scrolls the page: collapsible sidebar with your icon mark, workspace switcher, solid-fill active nav, breadcrumb top bar with quick search and account menu, and a slide-over sidebar on tablet and mobile.
Overhanging Logo & Mega Menu Header
Full-width sticky product header with your real sticker logo hanging over the bottom edge at -3deg (it straightens on hover), anchored mega menus with icons and a featured callout, and a slide-down menu on tablet and mobile. Swap the logo in one prop.