Prodular UI

Workspace switcher

Pro

Switches between organizations and workspaces: searchable, grouped by organization, recent ones first, with create and settings actions. Sizes itself for the App shell sidebar, its collapsed rail and a top navigation.

npx prodular-ui add workspace-switcher

Part of Prodular UI Pro. Preview and read the docs freely, install with a license. See pricing

Organizations and recent

Seven workspaces in four organizations. Switching moves the previous one into Recent.

Search appears from six workspaces. Recent ones stay on top, the rest group by organization.

Anatomy

<WorkspaceSwitcher  workspaces={workspaces}  value={workspaceId}  onValueChange={(id) => router.push(`/${id}/invoices`)}  recent={recentIds}  onCreate={openCreateDialog}/>

Guidance

Use it when

  • Apps where one person belongs to several workspaces, teams or client accounts.
  • In the brand slot of App shell, or at the start of a top bar.
  • meta for the plan, member count or region, so people pick the right one at a glance.

Avoid

  • Switching between projects inside one workspace. Use a Select or the page nav.
  • Hiding create behind the switcher when creating workspaces is rare. Keep onCreate for apps where it is common.

Rules for AI agents

Published in llms-full.txt, the registry and the MCP server, so coding agents follow them when they build with this component.

  • Pass workspaces as { id, name, organization?, meta?, logo?, color? }[] and the active id as value.
  • Keep recent as the ids of the last workspaces used, newest first; the list shows three.
  • On onValueChange, switch the data scope and route to the same page in the new workspace, not to its home.
  • Without a logo the initial shows on a tint of a chart color; set color to a var(--chart-N) token for a fixed one.
  • The trigger has an accessible name with the active workspace. The list is a combobox: arrows move, Enter switches, typing searches.

API

WorkspaceSwitcher

PropTypeDefaultDescription
workspacesWorkspace[]{ id, name, organization?, meta?, logo?, color? }.
value / onValueChangestring / (id, workspace) => voidThe active workspace, controlled.
recentstring[]Recently used ids, newest first.
onCreate / onSettings() => voidAdds Create workspace and Workspace settings.
searchFromnumber6Search appears from this many workspaces.

WorkspaceLogo

PropTypeDefaultDescription
workspace / sizeWorkspace / "sm" | "md"The square mark on its own, for lists and settings.

Installation

The Prodular UI CLI adds the source to components/ui with everything it depends on. In a project that already uses shadcn/ui, the shadcn CLI installs it from the Prodular registry too. See Installation for the first setup.

npx prodular-ui add workspace-switcher# or, with the registry in components.jsonnpx shadcn@latest add @prodular/workspace-switcher