Ballmac UI home

Team Switcher

A workspace picker: the current team on a button, the others in a radio menu with logos and descriptions, an add-team row, and a compact icon mode.

Working in Acme Inc.

Installation

$ pnpm dlx shadcn@latest add @ballmac/team-switcher

Usage

import { TeamSwitcher } from "@/components/ballmac/team-switcher"

The full example is in the Code tab above.

Examples

Compact

Compact mode for a collapsed sidebar. The menu opens to the side.

API reference

PropTypeDefault
teams*

Teams to choose from.

Team[]—
value

Controlled selected team id.

string—
defaultValue

Initial team id when uncontrolled.

string—
onValueChange

Called with the chosen team id.

(id: string) => void—
onAddTeam

Shows an "Add team" row at the end of the menu and calls this when chosen.

() => void—
addLabel

Label of the add row.

string—
compact

Show only the logo (for a collapsed sidebar). The name stays available to screen readers.

booleanfalse
align

Menu alignment relative to the trigger.

"start" | "center" | "end""start"
side

Side of the trigger the menu opens on.

"top" | "right" | "bottom" | "left""bottom"

Also accepts the standard attributes of its root element.

Accessibility

KeyAction
Enter / Space / ArrowDownOpens the menu
ArrowUp / ArrowDownMoves between teams
EnterChooses the team
EscapeCloses and returns focus

Use with AI

teams: {id,name,description,logo}. value/defaultValue/onValueChange choose the active team; onAddTeam adds the last row; compact shows only the logo. With the shadcn MCP server set up (guide), ask your agent:

Add the Ballmac UI Team Switcher (@ballmac/team-switcher) to this project with the shadcn MCP, then use it where it fits.

Use it for

  • Multi-workspace apps in a sidebar or header
  • Switching organizations or projects

Not for

  • Choosing a value in a form; use select or combobox
  • Long searchable lists; use combobox

Registry JSON: https://ui.ballmac.com/r/team-switcher.json

Credits

Free to use in personal and commercial projects.