Account Switcher
Switch between personal and organization accounts.
The account switcher lets users navigate between their personal account and organizations. It appears in the sidebar and updates the application context without changing the URL path.
The account switcher is a sidebar dropdown that lets users navigate between personal and organization accounts without changing the URL path. When a user selects an account, the application context updates and redirects to that account's dashboard. All pages then reflect the selected account's data through workspace hooks.
The account switcher is a context-aware dropdown component (DashboardDropdown) that manages active account selection. It stores the selected account in application state, enabling multi-tenant navigation without URL-based routing.
| Property | Value |
|---|---|
| Component | DashboardDropdown |
| Location | apps/web/app/[locale]/(internal)/dashboard/_components/dashboard-dropdown.tsx |
How It Works
- User clicks the account switcher in the sidebar
- Dropdown shows available accounts (personal + organizations)
- User selects an account
- Application context updates with the new active account
- User is redirected to the dashboard of the selected account
- All pages now reflect the selected account's data
The dropdown displays:
| Item | When Shown |
|---|---|
| Personal Account | Hybrid mode only |
| Organizations | Hybrid or organizations-only mode |
| Create Organization | When organization creation is enabled |
Behavior by Account Mode
| Mode | Personal Account | Organizations | Create Button |
|---|---|---|---|
hybrid | ✅ Shown first | ✅ Listed below | ✅ Available |
personal-only | ✅ Single option | ❌ Hidden | ❌ Hidden |
organizations-only | ❌ Hidden | ✅ All listed | ✅ Available |
Configure modes in Account Modes.
Search Functionality
Users with many organizations can search by name using the built-in search field. The search filters the dropdown list in real-time.
Avatars and Display
- Organizations: Show configured logo or fallback to first letter of name
- Personal accounts: Show user's profile picture or default icon
- Active account: Highlighted with a checkmark
Accessing Current Account in Code
After switching, access the active account using workspace hooks:
// In organization pagesimport { useTeamAccountWorkspace } from '@kit/team-accounts/hooks/use-team-account-workspace';function TeamPage() { const { account } = useTeamAccountWorkspace(); // account.id = active organization ID // account.name = organization name}Common Pitfalls
- Forgetting context updates aren't instant: After switching, the page redirects. Don't expect state to update in the current render.
- Using wrong workspace hook: Use
useTeamAccountWorkspace()for organization pages,useUserWorkspace()for personal account pages. - Expecting URL changes: The account switcher updates application state, not the URL path. Routes stay the same (
/dashboard,/settings).
Frequently Asked Questions
Can I customize which accounts appear in the switcher?
How do I hide the account switcher entirely?
Can users create organizations from the switcher?
What happens to unsaved work when switching accounts?
Next: Settings →