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.
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.jsonPrefer 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
| Prop | Type | Default | Description |
|---|---|---|---|
| heading | string | "Credit history" | Heading shown in the panel's header. |
| balance | string | none | Optional current balance shown at the right of the header, omitted if not passed. |
| transactions | CreditTransaction[] | none | Transaction rows rendered as-is, in the order given. |
| className | string | none | Extra 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
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.