TeamSwitcher() — ui Function Reference
Architecture documentation for the TeamSwitcher() function in team-switcher.tsx from the ui codebase.
Entity Profile
Dependency Diagram
graph TD 65d46e44_3ebb_c349_7aa8_428642619fbc["TeamSwitcher()"] d86a1d63_189f_b85e_f6a3_b77c1ae02a01["team-switcher.tsx"] 65d46e44_3ebb_c349_7aa8_428642619fbc -->|defined in| d86a1d63_189f_b85e_f6a3_b77c1ae02a01 style 65d46e44_3ebb_c349_7aa8_428642619fbc fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
apps/v4/registry/bases/base/blocks/sidebar-07/components/team-switcher.tsx lines 23–112
export function TeamSwitcher({
teams,
}: {
teams: {
name: string
logo: React.ReactNode
plan: string
}[]
}) {
const { isMobile } = useSidebar()
const [activeTeam, setActiveTeam] = React.useState(teams[0])
if (!activeTeam) {
return null
}
return (
<SidebarMenu>
<SidebarMenuItem>
<DropdownMenu>
<DropdownMenuTrigger
render={
<SidebarMenuButton
size="lg"
className="data-open:bg-sidebar-accent data-open:text-sidebar-accent-foreground"
/>
}
>
<div className="bg-sidebar-primary text-sidebar-primary-foreground flex aspect-square size-8 items-center justify-center rounded-lg">
{activeTeam.logo}
</div>
<div className="grid flex-1 text-left text-sm leading-tight">
<span className="truncate font-medium">{activeTeam.name}</span>
<span className="truncate text-xs">{activeTeam.plan}</span>
</div>
<IconPlaceholder
lucide="ChevronsUpDownIcon"
tabler="IconSelector"
hugeicons="UnfoldMoreIcon"
phosphor="CaretUpDownIcon"
remixicon="RiArrowUpDownLine"
className="ml-auto"
/>
</DropdownMenuTrigger>
<DropdownMenuContent
className="min-w-56 rounded-lg"
align="start"
side={isMobile ? "bottom" : "right"}
sideOffset={4}
>
<DropdownMenuGroup>
<DropdownMenuLabel className="text-muted-foreground text-xs">
Teams
</DropdownMenuLabel>
{teams.map((team, index) => (
<DropdownMenuItem
key={team.name}
onClick={() => setActiveTeam(team)}
className="gap-2 p-2"
>
<div className="flex size-6 items-center justify-center rounded-md border">
{team.logo}
</div>
{team.name}
<DropdownMenuShortcut>⌘{index + 1}</DropdownMenuShortcut>
</DropdownMenuItem>
))}
</DropdownMenuGroup>
<DropdownMenuSeparator />
<DropdownMenuGroup>
<DropdownMenuItem className="gap-2 p-2">
<div className="flex size-6 items-center justify-center rounded-md border bg-transparent">
<IconPlaceholder
lucide="PlusIcon"
tabler="IconPlus"
hugeicons="PlusSignIcon"
phosphor="PlusIcon"
remixicon="RiAddLine"
className="size-4"
/>
</div>
<div className="text-muted-foreground font-medium">
Add team
Domain
Subdomains
Source
Frequently Asked Questions
What does TeamSwitcher() do?
TeamSwitcher() is a function in the ui codebase, defined in apps/v4/registry/bases/base/blocks/sidebar-07/components/team-switcher.tsx.
Where is TeamSwitcher() defined?
TeamSwitcher() is defined in apps/v4/registry/bases/base/blocks/sidebar-07/components/team-switcher.tsx at line 23.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free