Home / Function/ TeamSwitcher() — ui Function Reference

TeamSwitcher() — ui Function Reference

Architecture documentation for the TeamSwitcher() function in team-switcher.tsx from the ui codebase.

Entity Profile

Dependency Diagram

graph TD
  8c8ad4ba_5c94_ae9a_f0ee_a110f90b90f3["TeamSwitcher()"]
  96fda3a1_4a07_149c_b9b6_9cd2779f42a4["team-switcher.tsx"]
  8c8ad4ba_5c94_ae9a_f0ee_a110f90b90f3 -->|defined in| 96fda3a1_4a07_149c_b9b6_9cd2779f42a4
  style 8c8ad4ba_5c94_ae9a_f0ee_a110f90b90f3 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

apps/v4/registry/bases/base/blocks/sidebar-15/components/team-switcher.tsx lines 22–104

export function TeamSwitcher({
  teams,
}: {
  teams: {
    name: string
    logo: React.ReactNode
    plan: string
  }[]
}) {
  const [activeTeam, setActiveTeam] = React.useState(teams[0])
  if (!activeTeam) {
    return null
  }
  return (
    <SidebarMenu>
      <SidebarMenuItem>
        <DropdownMenu>
          <DropdownMenuTrigger
            render={
              <SidebarMenuButton className="aria-expanded:bg-muted aria-expanded:text-foreground w-fit px-1.5" />
            }
          >
            <div className="bg-sidebar-primary text-sidebar-primary-foreground flex aspect-square size-5 items-center justify-center rounded-md">
              {activeTeam.logo}
            </div>
            <span className="truncate font-medium">{activeTeam.name}</span>
            <IconPlaceholder
              lucide="ChevronDownIcon"
              tabler="IconChevronDown"
              hugeicons="ArrowDown01Icon"
              phosphor="CaretDownIcon"
              remixicon="RiArrowDownSLine"
              className="opacity-50"
            />
          </DropdownMenuTrigger>
          <DropdownMenuContent
            className="w-64 rounded-lg"
            align="start"
            side="bottom"
            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-xs border">
                    {team.logo}
                  </div>
                  {team.name}
                  <DropdownMenuShortcut>⌘{index + 1}</DropdownMenuShortcut>
                </DropdownMenuItem>
              ))}
            </DropdownMenuGroup>
            <DropdownMenuSeparator />
            <DropdownMenuGroup>
              <DropdownMenuItem className="gap-2 p-2">
                <div className="bg-background flex size-6 items-center justify-center rounded-md border">
                  <IconPlaceholder
                    lucide="PlusIcon"
                    tabler="IconPlus"
                    hugeicons="PlusSignIcon"
                    phosphor="PlusIcon"
                    remixicon="RiAddLine"
                    className="size-4"
                  />
                </div>
                <div className="text-muted-foreground font-medium">
                  Add team
                </div>
              </DropdownMenuItem>
            </DropdownMenuGroup>
          </DropdownMenuContent>
        </DropdownMenu>
      </SidebarMenuItem>
    </SidebarMenu>

Subdomains

Frequently Asked Questions

What does TeamSwitcher() do?
TeamSwitcher() is a function in the ui codebase, defined in apps/v4/registry/bases/base/blocks/sidebar-15/components/team-switcher.tsx.
Where is TeamSwitcher() defined?
TeamSwitcher() is defined in apps/v4/registry/bases/base/blocks/sidebar-15/components/team-switcher.tsx at line 22.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free