<SelectedTeamSwitcher />

A React component for switching between teams. It displays a dropdown of teams and allows the user to select a team.

SelectedTeamSwitcher

For a comprehensive guide on using this component, refer to our Team Selection documentation.

Props

  • urlMap (optional): (team: Team) => string - A function that maps a team to a URL. If provided, the component will navigate to this URL when a team is selected.
  • selectedTeam (optional): Team - The initially selected team.
  • noUpdateSelectedTeam (optional): boolean - If true, prevents updating the selected team in the user’s settings when a new team is selected. Default is false.

Example

1import { SelectedTeamSwitcher } from '@stackframe/stack';
2
3export default function Page() {
4 return (
5 <div>
6 <h1>Team Switcher</h1>
7 <SelectedTeamSwitcher
8 urlMap={(team) => `/team/${team.id}`}
9 selectedTeam={currentTeam}
10 noUpdateSelectedTeam={false}
11 />
12 </div>
13 );
14}