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
  8804415e_8bde_460d_3c38_ef9da6c526c9["TeamSwitcher()"]
  b08c3d1e_0ed9_52e8_2ea0_bb3b23f8ee72["team-switcher.tsx"]
  8804415e_8bde_460d_3c38_ef9da6c526c9 -->|defined in| b08c3d1e_0ed9_52e8_2ea0_bb3b23f8ee72
  style 8804415e_8bde_460d_3c38_ef9da6c526c9 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

deprecated/www/registry/new-york/blocks/sidebar-10/components/team-switcher.tsx lines 21–83

export function TeamSwitcher({
  teams,
}: {
  teams: {
    name: string
    logo: React.ElementType
    plan: string
  }[]
}) {
  const [activeTeam, setActiveTeam] = React.useState(teams[0])

  if (!activeTeam) {
    return null
  }

  return (
    <SidebarMenu>
      <SidebarMenuItem>
        <DropdownMenu>
          <DropdownMenuTrigger asChild>
            <SidebarMenuButton className="w-fit px-1.5">
              <div className="flex aspect-square size-5 items-center justify-center rounded-md bg-sidebar-primary text-sidebar-primary-foreground">
                <activeTeam.logo className="size-3" />
              </div>
              <span className="truncate font-semibold">{activeTeam.name}</span>
              <ChevronDown className="opacity-50" />
            </SidebarMenuButton>
          </DropdownMenuTrigger>
          <DropdownMenuContent
            className="w-64 rounded-lg"
            align="start"
            side="bottom"
            sideOffset={4}
          >
            <DropdownMenuLabel className="text-xs text-muted-foreground">
              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-sm border">
                  <team.logo className="size-4 shrink-0" />
                </div>
                {team.name}
                <DropdownMenuShortcut>⌘{index + 1}</DropdownMenuShortcut>
              </DropdownMenuItem>
            ))}
            <DropdownMenuSeparator />
            <DropdownMenuItem className="gap-2 p-2">
              <div className="flex size-6 items-center justify-center rounded-md border bg-background">
                <Plus className="size-4" />
              </div>
              <div className="font-medium text-muted-foreground">Add team</div>
            </DropdownMenuItem>
          </DropdownMenuContent>
        </DropdownMenu>
      </SidebarMenuItem>
    </SidebarMenu>
  )
}

Subdomains

Frequently Asked Questions

What does TeamSwitcher() do?
TeamSwitcher() is a function in the ui codebase, defined in deprecated/www/registry/new-york/blocks/sidebar-10/components/team-switcher.tsx.
Where is TeamSwitcher() defined?
TeamSwitcher() is defined in deprecated/www/registry/new-york/blocks/sidebar-10/components/team-switcher.tsx at line 21.

Analyze Your Own Codebase

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

Try Supermodel Free