Skip to Content
⚠️Active Development Notice: TimeTiles is under active development. Information may be placeholder content or not up-to-date.

web


web / lib/hooks/use-admin-feature-flag

lib/hooks/use-admin-feature-flag

Standalone feature flag hook for the Payload CMS admin panel.

Uses plain useState/useEffect instead of React Query because the admin panel does not have a QueryClientProvider. Defaults to disabled (false) on fetch failure (fail-closed policy).

Functions

useAdminFeatureFlag()

useAdminFeatureFlag(flag): object

Fetches a single feature flag value for use in Payload admin components.

Parameters

flag

keyof FeatureFlags

The feature flag key to look up

Returns

object

{ isEnabled } where null means loading, true/false is the resolved value

isEnabled

isEnabled: boolean | null

Example

const { isEnabled } = useAdminFeatureFlag("enableScheduledImports"); if (isEnabled === null || isEnabled) return null; // loading or enabled return <WarningBanner />;
Last updated on