Overview
Add multi-tenant workspaces with member management and workspace switching.
Every user can belong to one or more workspaces. Each workspace has its own members, roles, subscription, and data.
import { useSaaSWorkspaces, WorkspaceSwitcher } from '@buildbase/sdk/react';
function Navbar() {
return (
<nav>
<WorkspaceSwitcher
trigger={(isLoading, ws) => (
<button>{ws?.name ?? 'Select workspace'}</button>
)}
/>
</nav>
);
}Note
BuildBase auto-creates a workspace for new users on first login. No setup step required.
WorkspaceSwitcher
A drop-in component with search, create, and switch built in. You only provide the trigger button:
| Prop | Type | Description |
|---|---|---|
trigger | (isLoading, currentWorkspace) => ReactNode | Render function for the trigger button |
To react to workspace switches, use the onWorkspaceChange callback in the provider's auth.callbacks — see Workspace Switcher.
useSaaSWorkspaces()
For reading workspace data or managing members programmatically:
| Property / Method | Description |
|---|---|
workspaces | All workspaces the user belongs to |
currentWorkspace | The active workspace |
switchToWorkspace(ws) | Change the active workspace |
createWorkspace(name) | Create a new workspace |
addUser(workspaceId, email, role) | Invite a member |
removeUser(workspaceId, userId) | Remove a member |
updateUser(workspaceId, userId, data) | Change a member's role |
getUsers(workspaceId) | List all members |
Pre-built settings
Open the workspace settings panel with one call — handles members, billing, features, and more:
import { useSaaSAuth } from '@buildbase/sdk/react';
function SettingsButton() {
const { openWorkspaceSettings } = useSaaSAuth();
return <button onClick={() => openWorkspaceSettings()}>Settings</button>;
}Available screens: profile, security, devices, connected-agents, general, users, subscription, usage, credits, features, notifications, permissions, danger.
Next Steps
- Workspace Switcher — Customizing the trigger.
- Managing Members — Invite users and check seats.
- Settings Screens — All pre-built screens.