Xzero UI
Pro library

Upgrade promptPro

An upgrade nudge for the moment someone hits a limit. It shows a usage meter at 50 of 50 AI credits, a rolling price with a monthly and yearly toggle, three concrete unlocks with real model marks, and Upgrade or Maybe later. Upgrading leads into a success state with the new limits, and the card never changes size between states.

$ pnpm dlx shadcn@4.23.0 add @xzero-ui-pro/upgrade-prompt
Live · keyboard ready

When to use

When not to use

Installation

Register both Xzero UI namespaces in your project's components.json:

{
  "registries": {
    "@xzero-ui": "https://mcp.xzero.co.uk/r/{name}.json",
    "@xzero-ui-pro": "https://mcp.xzero.co.uk/r/pro/{name}.json"
  }
}
npx shadcn@4.23.0 add @xzero-ui-pro/upgrade-prompt

Install xzero-foundation once, and import @/components/xzero/foundation.css in your app root. No Xzero token is used by this snapshot. For sample portraits, photos, fonts, or logos, download https://mcp.xzero.co.uk/install-assets.mjs and run node xzero-install-assets.mjs <receiving-project>.

Usage

import { UpgradePrompt } from "@/components/xzero/upgrade-prompt/upgrade-prompt";

export function OutOfCredits({ workspace, onClose, retry }) {
  return (
    <UpgradePrompt
      used={workspace.credits.used}
      limit={workspace.credits.limit}
      resetsOn="Nov 1"
      onUpgrade={async (selection, signal) => {
        const res = await fetch("/api/billing/upgrade", { method: "POST", body: JSON.stringify(selection), signal });
        if (!res.ok) throw new Error((await res.json()).message ?? "Your card was declined. Try another card.");
      }}
      onUpgraded={() => workspace.refresh()}
      onContinue={() => { onClose(); retry(); }}
      onDismiss={() => { fetch("/api/nudges/upgrade/snooze", { method: "POST" }); onClose(); }}
    />
  );
}

API reference

UpgradePrompt

The upgrade nudge shown the moment someone hits a limit: what they used, a usage meter, the price with a monthly and yearly toggle, what the next plan unlocks, Upgrade and Maybe later. Upgrading rolls into a success state with the new limits; Maybe later shows a calm reminder with a way back. With no props it shows a Free workspace at 50 of 50 AI credits and simulates the upgrade.

PropTypeDefaultDescription
usednumber50How much of the limit is used.
limitnumber50The current plan's limit. At or over it the meter reads Limit reached; below it, how many are left.
unitstring"AI credits"What is counted, plural, such as "AI credits", "seats" or "generations". Used in the title, meter and announcements.
resetsOnstring"Nov 1"When the current limit resets. Shown in the description and the Maybe later reminder.
planUpgradePlanPro, $20 a month or $16 a month yearly, 2,000 credits{ name, price: { monthly, yearly }, currency?, limit, features: { id, label }[], limits: { label, value }[] }. price.yearly is the per month price when billed yearly; the saving badge and the yearly charge derive from it. Feature labels and limit values take ReactNode, so inline marks work.
interval"monthly" | "yearly"–Billing interval, controlled.
defaultInterval"monthly" | "yearly""yearly"Billing interval on mount when interval is left out.
onIntervalChange(interval) => void–Called when the billing toggle changes.
onUpgrade(selection: UpgradeSelection, signal: AbortSignal) => Promise<void>–Starts the upgrade with { plan, interval, amount, currency }, where amount is charged today. Resolve when the plan is active; reject with an Error and its message shows under the price with Try again. Aborted on unmount. Leave it out to simulate a 1.1s upgrade.
onUpgraded(selection: UpgradeSelection) => void–Called once the upgrade succeeded, after the success state shows.
onDismiss() => void–Called by Maybe later. Record the snooze here; the card shows a reminder with See Pro again.
onContinue() => void–Called by Continue on the success state, usually to close the dialog and retry the blocked action. Leave it out and Continue resets the demo.
titleReactNode–Replaces the limit title, such as "You've used all 3 seats".
descriptionReactNode–Replaces the line under the title.
classNamestring–Extra class on the card.

Keyboard interactions

KeysAction
TabMoves through the billing toggle, Maybe later and Upgrade, or Continue and See Pro again in the other states.
ArrowLeft / ArrowRightSwitches between Monthly and Yearly on the billing toggle.
Enter / SpaceActivates the focused button.

Accessibility

Motion

Responsive behavior

Performance

Notes for AI

Also in ai

Guidance for AI tools

Upgrade prompt: An upgrade nudge for the moment someone hits a limit. It shows a usage meter at 50 of 50 AI credits, a rolling price with a monthly and yearly toggle, three concrete unlocks with real model marks, and Upgrade or Maybe later. Upgrading leads into a success state with the new limits, and the card never changes size between states. Follow the declared prop types and do not invent props. Keep keyboard access, reduced motion support, and both light and dark themes intact when adapting it.

Full library index: https://ui.xzero.co.uk/llms.txt

Browse all components