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.
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.jsonPrefer 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
| Prop | Type | Default | Description |
|---|---|---|---|
| heading | string | "Credits expiring soon" | Heading shown above the alert stack. |
| pools | CreditPool[] | none | Credit pools rendered as-is, one alert per entry, in the order given. |
| redeemLabel | string | "Use credits" | Label for each pool's redeem button. |
| className | string | none | Extra 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
More Billing Blocks
View all →Billing Invoice List
Invoice history table with status badges, formatted amounts, and a per-row download link, built with shadcn/ui and Tailwind CSS.
Billing Failed Payment Alert
High-contrast failed-payment alert with a message, a retry button, and an optional update-payment-method button, built with shadcn/ui and Tailwind CSS.
Billing Credit Balance
Compact credit balance card with a large total, an optional purchased-versus-promotional breakdown, a low-balance notice, and a top-up button.
Billing Payment Methods
A saved payment method list for React and Next.js with brand icons, a default badge, near-expiry warnings, and remove/set-default actions per row.
Billing Add Card
A card entry form for React and Next.js with auto-formatted fields, internal brand detection, and per-field validation feedback built with shadcn/ui and Tailwind CSS.
Billing Coupon Code
An inline promo code input for React and Next.js with a simulated loading state, an applied summary showing the discount amount, and an invalid-code message.