Staaarter

Billing Low Credit Warning

A low credit balance warning for pay-as-you-go and usage-based billing. It highlights the current balance, an optional estimated-days-remaining note, a row of quick top-up amounts, and whether auto-recharge is currently on or off. The card switches to an amber warning treatment once the balance is at or below the threshold you pass in. Built for API platforms, pay-as-you-go cloud services, and credit-based SaaS tools.

By Staaarter Team
Billing
Updated May 27, 2026
Docs
Live preview

Docs

Installation

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

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

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

Usage

The file also exports billing70Demo, 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 { Billing70, billing70Demo } from "@/components/blocks/billing/billing70";

export default function Page() {
  return <Billing70 {...billing70Demo} />;
}

Props

PropTypeDefaultDescription
headingstring"Your balance is running low"Heading shown next to the warning icon.
descriptionstring"Add credit now to avoid an interruption in service."Supporting text under the heading.
currentBalancenumbernoneCurrent balance in dollars, shown formatted to two decimal places.
lowBalanceThresholdnumbernoneWhen currentBalance is at or below this, the card switches to the amber warning treatment.
estimatedDaysRemainingnumbernoneOptional estimated days left at current usage, shown next to the balance.
autoRechargeEnabledbooleanfalseWhether to show the auto-recharge status row as on or off.
quickAmountsQuickTopUpAmount[]nonePreset top-up amounts, each rendered as a link to topUpHref.
topUpHrefstringnoneDestination for every quick top-up amount button.
manageHrefstringnoneOptional link to a full billing settings page, shown under the card.
classNamestringnoneExtra classes for the outer container.

Types

interface QuickTopUpAmount {
  value: number;
  label?: string;
}

Behavior notes

  • isLow is computed on every render from currentBalance and lowBalanceThreshold. There's no internal timer or polling, pass an updated currentBalance to reflect a new balance.
  • The card's border and icon color switch to amber only when currentBalance is at or below lowBalanceThreshold, otherwise it renders with the default card styling.
  • Quick top-up amounts are next/link buttons pointed at a single topUpHref, they don't charge a card or update the balance themselves, wire the actual charge into whatever page topUpHref leads to.
  • autoRechargeEnabled is a display-only boolean, toggling it requires re-rendering the component with a new value from your own settings state, there's no built-in switch here.
  • estimatedDaysRemaining and manageHref are both optional and each independently omit their row when not provided.

Frequently asked questions