Team Switcher
Your role in every workspace, in the row, before you switch into it.
PROGet Team Switcher and 168 other Pro components with pro lifetime — Get Pro
- Category
- Workspace
- Access
- ProPro · unlocked
- Source
- 423 lines · one file
The decision inside it
The role is in the list, before you pick
Otherwise you switch, the page reloads into a read-only view, and nothing explains why everything is greyed out. That fact was knowable before the click.
When to use it
Use Team Switcher to move between workspaces or organisations: the current one with its logo, a searchable list with your role in each, and Create workspace.
Installation
How you get it
Paste this into Claude Code, Cursor, Codex or any coding agent. It installs the file and uses it as it is, instead of writing a new one.
Use Liro's Team Switcher for this.
Install it: npx shadcn@latest add @liro/team-switcher
(the @liro registry is set up in components.json, with LIRO_KEY in .env.local)
Import it from @/components/ui/team-switcher.
Do not rewrite or restyle it. Pass my data through its props
and keep its built-in states.For the full brief with every prop and the mistakes assistants usually make, use Copy prompt above. Pro components install through the @liro registry with your CLI token: see the Namespaced tab.
Usage
import { TeamSwitcher, type Workspace } from "@/components/ui/team-switcher";
const workspaces: Workspace[] = [
{ id: "nw", name: "Madgixs", role: "owner", meta: "Team plan" },
{ id: "vl", name: "Vertically", role: "member" },
];
export function WorkspaceMenu({ current, switchTo, create }: { current: string; switchTo: (id: string) => void; create: () => void }) {
return <TeamSwitcher workspaces={workspaces} value={current} onSelect={switchTo} onCreate={create} />;
}API reference
“Copy prompt” above puts a full brief on your clipboard, install command, dependencies, props, and the mistakes an assistant usually makes with this component.
Props
Read from the component’s own TypeScript interface when the site is built, so this table cannot drift from the file you install.
| Type | Notes | ||
|---|---|---|---|
workspaces | Workspace[] | No | – |
value | string | No | Id of the workspace you are in. |
onSelect | (id: string, workspace: Workspace) => void | No | – |
onCreate | () => void | No | Shown as a row at the foot of the list. Omit to hide it. |
createLabel | string | No | – |
listHeight | number | No | Height of the scrolling list in px. Default 268. |
Dependencies
npm packages
clsxframer-motionlucide-reacttailwind-mergeLiro foundations, installed alongside it
liro-themerole-chipworkspace-markAccessibility
- Keyboard reachable throughout, in visual order
- Focus trapped in overlays, Escape closes them
- Focus returns to whatever opened it
- Live regions announce what changed, not that something did
- Honours prefers-reduced-motion
Responsive behavior
- Sizes to its container, not the viewport
- Usable from 320px up
- Pointer-based interaction, so trackpad and touch both work
- No hover-only affordances