Workspace Label

A comprehensive workspace switcher with member avatars, pending request notifications, collapsible info card panel, and keyboard shortcuts for rapid workspace navigation.

Preview

Installation

Use the CLI to add this component to your project.

npx shadcn@latest add https://ui.nyxhora.com/r/workspace-label.json

Usage

tsx
31 lines
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import { useState } from "react"
import WorkspaceLabel from "@/components/ui/workspace-label"
import type { WorkspaceItem, MemberItem, PendingRequest } from "@/registry/ui/workspace-label"

const workspaces: WorkspaceItem[] = [
  { id: "1", name: "Personal",  description: "My personal workspace", icon: "🏠", color: "#3B82F6" },
  { id: "2", name: "Acme Corp", description: "Company workspace",     icon: "🏢", color: "#10B981" },
]

const members: MemberItem[] = [
  { id: "1", name: "John Doe",   email: "john@example.com", role: "admin"  },
  { id: "2", name: "Jane Smith", email: "jane@example.com", role: "member" },
]

export default function Sidebar() {
  const [activeId, setActiveId] = useState("1")

  return (
    <aside className="w-64 border-r p-4">
      <WorkspaceLabel
        workspaces={workspaces}
        members={members}
        activeWorkspaceId={activeId}
        onWorkspaceChange={setActiveId}
        onCreateWorkspace={() => router.push("/workspaces/new")}
        onInvite={() => setInviteOpen(true)}
        updatedAt="Jan 28, 2026"
      />
    </aside>
  )
}

Keyboard Shortcuts

ShortcutAction
⌘,Toggle info card panel
⌘1⌘9Switch to workspace 1–9

Props

PropTypeDefaultDescription
workspacesWorkspaceItem[]-List of workspaces to display in the switcher.
membersMemberItem[][]Team members shown as stacked avatars.
pendingRequestsPendingRequest[][]Pending join requests — shows an animated bell badge when non-empty.
activeWorkspaceIdstringundefinedID of the currently active workspace.
onWorkspaceChange(id: string) => voidundefinedCalled when the user selects a different workspace.
onCreateWorkspace() => voidundefinedCalled when the Create workspace button is clicked.
onInvite() => voidundefinedCalled when the Invite quick action is clicked.
onViewRequests() => voidundefinedCalled when the Requests quick action or bell badge is clicked.
onSettings() => voidundefinedCalled when the settings icon in the info card footer is clicked.
updatedAtstringundefinedOptional last-updated label shown in the info card header.