Staaarter

Billing Referral Credit

A referral credit card showing the account's available credit balance, an 'Apply to next invoice' toggle, and a referral link with a copy button. Meant for a billing dashboard or referral program screen where a user tracks and applies rewards earned from inviting others.

By Staaarter Team
Billing
Updated June 1, 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-referral-credit.json

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

Usage

The file also exports billing110Demo, 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 { Billing110, billing110Demo } from "@/components/blocks/billing/billing110";

export default function Page() {
  return <Billing110 {...billing110Demo} />;
}

Props

PropTypeDefaultDescription
headingstring"Referral credit"Card heading.
descriptionstringnoneOptional one-line note under the heading.
creditBalancestringnoneAvailable credit total, already formatted as currency.
pendingReferralsnumbernoneOptional count of referrals not yet converted; the note is omitted when 0 or unset.
referralLinkstringnoneThe link shown in the read-only field and copied by the copy button.
defaultApplyToNextInvoicebooleantrueStarting state of the apply-to-next-invoice toggle.
classNamestringnoneExtra classes for the outer container.

Behavior notes

  • "Apply to next invoice" is local toggle state (defaultApplyToNextInvoice sets the initial value); the component doesn't call your backend, so wire the toggle's resulting value into your own invoice logic.
  • The copy button uses navigator.clipboard.writeText on the referralLink value and swaps to a checkmark for 2 seconds; if the clipboard permission is denied, it silently falls back to leaving the link selectable in the input.
  • This is a client component because both the toggle and the copy button need browser-side state and the Clipboard API.
  • pendingReferrals only renders its note when it's a positive number, so omit it or pass 0 to hide the line entirely.

Frequently asked questions