Staaarter

Billing Credit History Log

A chronological log of account credit transactions, top-ups, usage deductions, referral bonuses, refunds, and expirations, each with its own icon and a color-coded amount. An optional current balance shows in the header. Built as an audit trail for consumption-based products and marketplaces where users need to see exactly where their credit came from and went.

By Staaarter Team
Billing
Updated March 27, 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-credit-history-log.json

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

Usage

The file also exports billing40Demo, 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 { Billing40, billing40Demo } from "@/components/blocks/billing/billing40";

export default function Page() {
  return <Billing40 {...billing40Demo} />;
}

Props

PropTypeDefaultDescription
headingstring"Credit history"Heading shown in the panel's header.
balancestringnoneOptional current balance shown at the right of the header, omitted if not passed.
transactionsCreditTransaction[]noneTransaction rows rendered as-is, in the order given.
classNamestringnoneExtra classes for the outer container.

Types

type TransactionType = "topup" | "usage" | "referral" | "refund" | "expired";

interface CreditTransaction {
  id: string;
  type: TransactionType;
  description: string;
  date: string;
  amount: string;
}

Behavior notes

  • Amount color is decided by whether the amount string starts with "-", not by the transaction type, so pass amount already formatted with its sign (for example "+$25.00" or "-$5.00").
  • Each row's icon comes from an internal type-to-icon lookup (topup, usage, referral, refund, expired), so the caller only ever passes a plain string, never a component.
  • The list is a plain, unsorted rendering of whatever order the transactions array is in. Sort newest-first before passing it in if that's the order you want.
  • There's no pagination or virtualization built in; long histories should be paged or windowed before reaching this component.

Frequently asked questions