Staaarter

Billing Credit Expiry

A stack of alert cards, one per credit pool, showing the amount, when it expires, and how many days are left. Each pool carries an urgency level that changes the icon and color, and an optional redeem link. Built for promotional campaigns, referral rewards, and trial accounts where unused credit is about to lapse.

By Staaarter Team
Billing
Updated June 11, 2026
Docs
Live preview

Docs

Installation

A real shadcn registry command, not a copy-paste stand-in: it fetches this block plus its alert, button dependencies and any missing npm packages, and installs them straight into your project.

npx shadcn add https://staaarter.com/r/billing-credit-expiry.json

Prefer not to use the CLI? Copy the source from the Code toggle above into src/components/blocks/billing/billing39.tsx instead.

Usage

The file also exports billing39Demo, the exact props behind the preview above. Spread it to get a working section in one line, then replace it with your own data.

import { Billing39, billing39Demo } from "@/components/blocks/billing/billing39";

export default function Page() {
  return <Billing39 {...billing39Demo} />;
}

Props

PropTypeDefaultDescription
headingstring"Credits expiring soon"Heading shown above the alert stack.
poolsCreditPool[]noneCredit pools rendered as-is, one alert per entry, in the order given.
redeemLabelstring"Use credits"Label for each pool's redeem button.
classNamestringnoneExtra classes for the outer container.

Types

type ExpiryUrgency = "low" | "medium" | "high";

interface CreditPool {
  id: string;
  amount: string;
  expiresLabel: string;
  daysRemaining: number;
  urgency: ExpiryUrgency;
  redeemHref?: string;
}

Behavior notes

  • urgency drives both the icon (Clock, AlertTriangle, or Flame) and its color through an internal lookup, so the demo data only ever passes the plain low/medium/high string.
  • A high-urgency pool also switches the Alert component itself to the destructive variant, giving it a red border and background tint, not just a red icon.
  • daysRemaining is a plain number you compute and pass in; the component doesn't read the current date or do any date math itself.
  • The redeem button only renders when redeemHref is set, some pools (for example already-lapsed ones you still want to log) can omit it.

Frequently asked questions