Components
FeatureGate
Render UI only when the wallet has unlocked a feature.
FeatureGate checks whether the wallet has a feature unlocked - via an active
subscription, a one-time purchase, or a manual grant - and renders its children
or a fallback. The default fallback is a scoped PurchaseButton that only shows
prices unlocking the requested feature.
Unlike CreditGate, nothing is consumed. Access
is derived, so the gate opens and closes automatically as the subscription
renews or ends.
Checking feature...
import { FeatureGate } from "@/components/neonfin/feature-gate";
export function AnalyticsPanel() {
return (
<FeatureGate feature="analytics">
<div>Analytics unlocked</div>
</FeatureGate>
);
}Install
npx shadcn@latest add https://pay.vantezzen.io/r/neonfin-gate.jsonShips alongside CreditGate in the same registry item.
Usage
import { FeatureGate } from "@/components/neonfin/feature-gate";
export function Analytics() {
return (
<FeatureGate feature="analytics">
<AnalyticsDashboard />
</FeatureGate>
);
}With a custom fallback:
<FeatureGate
feature="export"
fallback={<PurchaseButton>Unlock export</PurchaseButton>}
>
<ExportButton />
</FeatureGate>Or customize the built-in scoped fallback:
<FeatureGate
feature="export"
purchaseButtonProps={{ variant: "outline" }}
>
<ExportButton />
</FeatureGate>Props
| Prop | Type | Required | Description |
|---|---|---|---|
feature | string | Yes | Feature slug required to show children. |
productId | string | No | Limit the purchase fallback to one product. |
children | React.ReactNode | Yes | UI shown when the feature is unlocked. |
fallback | React.ReactNode | No | UI shown otherwise. Defaults to PurchaseButton. |
purchaseButtonProps | PurchaseButtonProps | No | Customize the default scoped purchase button. |
Checking a feature imperatively
Use useFeature when you need the boolean rather than a wrapper:
import { useFeature } from "@/components/neonfin/provider";
const { enabled, loading } = useFeature("analytics");See Access & features for how features are attached to prices and derived.