Staaarter

Billing Revenue Analytics Mini

A condensed billing analytics card showing this month's spend, last month's spend, the running average, and a trend arrow comparing the two. A top-3 category breakdown with proportional bars sits underneath. Built for account dashboards and executive summary screens where someone needs the shape of recent spending at a glance, not a full report.

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

Docs

Installation

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

npx shadcn add https://staaarter.com/r/billing-revenue-analytics-mini.json

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

Usage

The file also exports billing116Demo, 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 { Billing116, billing116Demo } from "@/components/blocks/billing/billing116";

export default function Page() {
  return <Billing116 {...billing116Demo} />;
}

Props

PropTypeDefaultDescription
headingstring"Spending overview"Heading shown at the top of the card.
periodLabelstring"This month"Label above the current period's total.
thisMonthnumbernoneCurrent period's total spend.
lastMonthnumbernonePrevious period's total spend, used to compute the trend percentage.
averagenumbernoneRunning average monthly spend, shown as a secondary stat.
currencySymbolstring"$"Prefix applied to every formatted amount.
breakdownRevenueCategory[]noneSpend by category. Only the first three entries are rendered.
classNamestringnoneExtra classes for the outer card.

Types

interface RevenueCategory {
  label: string;
  amount: number;
}

Behavior notes

  • The trend percentage is computed as (thisMonth - lastMonth) / lastMonth * 100, rounded to one decimal place, and is 0 when lastMonth is 0.
  • An increase in spend is shown in the destructive color with an up-right arrow, a decrease in an emerald color with a down-right arrow, since a rising bill is the unfavorable direction here.
  • breakdown is sliced to its first three entries; pass a pre-sorted array (highest spend first) if you want the biggest categories to lead.
  • Each breakdown bar's width is relative to the largest amount in the shown slice, not to thisMonth, so three similarly sized categories will show similarly sized bars.
  • All amounts are formatted with two decimal places and the given currencySymbol; there's no locale-aware currency formatting beyond toLocaleString's grouping.

Frequently asked questions