Staaarter

Billing Metered Usage Forecast

A forecast card that shows a projected end-of-billing-cycle cost next to what's been spent so far, with a trend badge comparing pace to the previous cycle and a progress bar marking how far through the cycle the account currently is. Built for metered SaaS products where customers pay for API calls, compute, or storage and want a heads-up before the invoice arrives.

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

Docs

Installation

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

npx shadcn add https://staaarter.com/r/billing-metered-usage-forecast.json

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

Usage

The file also exports billing74Demo, 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 { Billing74, billing74Demo } from "@/components/blocks/billing/billing74";

export default function Page() {
  return <Billing74 {...billing74Demo} />;
}

Props

PropTypeDefaultDescription
titlestring"Usage forecast"Heading shown in the card header.
descriptionstringnoneOptional supporting line under the heading.
currencySymbolstring"$"Symbol prefixed to both the current and projected amounts.
currentCostnumbernoneCost incurred so far this billing cycle.
projectedCostnumbernoneProjected total cost by the end of the cycle.
budgetnumbernoneOptional budget threshold; when projectedCost exceeds it the footer note switches to a warning.
daysElapsednumbernoneDays elapsed in the current billing cycle, used for the progress bar.
daysInCyclenumbernoneTotal length of the billing cycle in days.
trendPercentnumbernonePercent change versus the same point in the previous cycle; shown as a colored badge with a trend icon.
classNamestringnoneExtra classes for the outer card.

Behavior notes

  • The forecast numbers (currentCost, projectedCost) are passed in as-is, the component doesn't run any prediction math itself, it only formats and displays what you compute upstream.
  • The trend badge picks its icon and color from the sign of trendPercent: up-and-amber for positive, down-and-emerald for negative, a dash for zero or when the prop is omitted.
  • The cycle-progress bar is daysElapsed / daysInCycle, capped at 100%, and is purely visual, it does not gate or affect the cost numbers.
  • The budget note only renders when budget is provided, and switches between a neutral 'on track' message and a destructive-colored overage message depending on whether projectedCost exceeds it.

Frequently asked questions