Components
OrganizationSwitcher
Drop-down to switch the active organization for the signed-in user.
<OrganizationSwitcher />
Exposes the org-switching UX. When a user belongs to multiple orgs, shows the active one plus a menu listing the others and a "Create organization" CTA.
Import
Usage
import { OrgSwitcher }
Props
| Prop | Type | Default | Description |
|---|---|---|---|
onChange | (org: Organization) => void | undefined | Fires after switch |
hideCreateCTA | boolean | false | Hide "Create organization" |
appearance | { width?: number } | undefined | Visual overrides |
What "switch" does
The switcher calls useSetActiveOrganization() under the hood, which:
- Sets the
X-Avnology-Orgcookie on<Domain id="app"/>. - All subsequent SDK calls scope to the new org automatically.
- Emits a
session.organization_switchedaudit event.
Switching does not re-authenticate -- the session stays the same.
Related
- UserButton -- includes the switcher by default
- Organizations API