Skip to content

Commit 7dc461a

Browse files
author
patched.codes[bot]
committed
Patched /Users/codelion/Documents/GitHub/stack/docs/fern/docs/pages/sdk/selected-team-switcher.mdx
1 parent 894f08a commit 7dc461a

1 file changed

Lines changed: 36 additions & 0 deletions

File tree

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
---
2+
title: SelectedTeamSwitcher
3+
---
4+
5+
# SelectedTeamSwitcher
6+
7+
A React component for switching between teams. Displays a dropdown of available teams and handles team selection.
8+
9+
## Parameters
10+
11+
- `props`: `SelectedTeamSwitcherProps`
12+
- `selectedTeam` (optional): The initially selected team
13+
- `noUpdateSelectedTeam` (optional): `boolean` - If true, prevents updating the selected team in the user's settings
14+
- `urlMap` (optional): `(team: Team) => string` - A function to generate a URL for the selected team
15+
16+
## Example
17+
18+
```tsx
19+
import { SelectedTeamSwitcher } from '@stackframe/stack';
20+
21+
// Basic usage
22+
<SelectedTeamSwitcher />
23+
24+
// With custom URL mapping
25+
<SelectedTeamSwitcher
26+
urlMap={(team) => `/team/${team.id}`}
27+
/>
28+
29+
// Prevent updating selected team
30+
<SelectedTeamSwitcher
31+
noUpdateSelectedTeam={true}
32+
selectedTeam={initialTeam}
33+
/>
34+
```
35+
36+
This component uses various hooks and context providers from the Stack SDK, such as `useStackApp`, `useUser`, and `useRouter`. It displays the current team, other available teams, and an option to create a new team if enabled in the project configuration.

0 commit comments

Comments
 (0)