Workspace Switcher
Switch the active workspace or sign out from an authenticated sidebar.
Sidebar Workspace Switcher
The preview renders WorkspaceSwitcherMenu with sample workspaces. In your app, use WorkspaceSwitcher inside an Auth Provider. The switcher reads the signed-in account and workspaces, updates the active workspace, and signs the user out. Users can open the menu and choose a workspace before their session has an active workspace.
import { AuthProvider, WorkspaceSwitcher } from "@notion-kit/auth-ui";
<AuthProvider authURL="https://auth.example.com">
<WorkspaceSwitcher
onWorkspaceChange={({ slug }) => {
window.location.assign(`/workspace/${encodeURIComponent(slug)}`);
}}
/>
</AuthProvider>;Installation
pnpm add @notion-kit/auth-uiThe Shadcn command installs the sample menu shown in the preview.
API reference
Use the callbacks to wire app-specific navigation and dialogs. The switcher calls onWorkspaceChange and onSignedOut after the corresponding auth operation succeeds.
Prop
Type