Skip to content

useCan

useCan(handle, options?): UseCanResult

Reactive counterpart to the imperative rt.can(handle) — the entitlement check as a can question. Takes the entitlement handle positionally (matching rt.can('handle')), plus the same options useEntitlement accepts, and returns a curated { can, limited, isLoading, result }.

Deny-until-ready: can is false while the check is unresolved, flipping within one microtask in local mode once the Playbook is in memory. Use isLoading to distinguish “still deciding” from a settled deny.

For the full reactive surface (allowed / denied / error / gatedPlacement / recheck), use useEntitlement directly.

string

Omit<UseEntitlementOptions, "handle">

UseCanResult

function BatchExport() {
const { can, limited, isLoading } = useCan('batch_export');
if (!can && isLoading) return null; // still deciding — render nothing yet
if (!can) return <UpgradePrompt />; // settled deny
return <BatchExportButton warnLowBalance={limited} />;
}