Overview
Gate features by subscription plan or target specific users for beta rollouts.
BuildBase provides two types of feature flags. Workspace features are tied to plans — upgrade to Pro and get analytics. User features target specific users — assign users directly, or target them through user lists or audience lists.
import {
WhenUserFeatureEnabled,
WhenWorkspaceFeatureDisabled,
WhenWorkspaceFeatureEnabled,
} from '@buildbase/sdk/react';
function Dashboard() {
return (
<>
<WhenWorkspaceFeatureEnabled slug="advanced-analytics">
<AdvancedAnalytics />
</WhenWorkspaceFeatureEnabled>
<WhenWorkspaceFeatureDisabled slug="advanced-analytics">
<p>Upgrade to Pro for analytics.</p>
</WhenWorkspaceFeatureDisabled>
<WhenUserFeatureEnabled slug="beta-editor">
<NewEditor />
</WhenUserFeatureEnabled>
</>
);
}Before you start
Create feature flags in the BuildBase dashboard. Workspace features are configured per plan. User features are targeted to individual users, user lists, or audience lists.
Components
| Component | Renders when |
|---|---|
WhenWorkspaceFeatureEnabled | Workspace feature is on (tied to plan) |
WhenWorkspaceFeatureDisabled | Workspace feature is off |
WhenUserFeatureEnabled | User feature targets the current user (directly, or via a user or audience list) |
WhenUserFeatureDisabled | User feature does not target the current user |
All take a slug prop (the feature identifier from the dashboard) and children.
Combining with other components
Feature flags compose naturally with permissions, subscriptions, and credits:
import {
Permission,
WhenCreditsAvailable,
WhenPermission,
WhenWorkspaceFeatureEnabled,
} from '@buildbase/sdk/react';
function AISection() {
return (
<WhenWorkspaceFeatureEnabled slug="ai-generation">
<WhenPermission permission={Permission.WORKSPACE_BILLING_MANAGE}>
<WhenCreditsAvailable min={10}>
<GenerateButton />
</WhenCreditsAvailable>
</WhenPermission>
</WhenWorkspaceFeatureEnabled>
);
}Pre-built features screen
openWorkspaceSettings('features') shows a built-in screen where workspace admins can toggle user-managed feature flags.
Limitations and behavior
| Behavior | Detail |
|---|---|
| Toggle source | User-managed workspace features toggle via updateFeature(workspaceId, key, value) on useSaaSWorkspaces() or bb.features.update(workspaceId, key, value) server-side. Plan-tied workspace features follow the plan, and user feature targeting is dashboard-only |
| Propagation | Changes take effect on the next page load or session refresh (not instant for active sessions) |
| Caching | Flags are fetched with the session data and cached locally. No additional API calls per render |
| Rollback | Disabling a flag hides gated UI immediately on next load. Running code is not interrupted |
| Analytics | No built-in A/B analytics — you must track conversions yourself (e.g. via workflows or your own analytics) |
| Nesting | Feature flag components can be nested with permission and subscription gates — they compose naturally |
Next Steps
- Permissions — Role-based access control.
- Billing — Tie features to subscription plans.