Staaarter

Billing Wallet Recharge

A recharge form for usage-based wallets and prepaid credit balances. Preset amount buttons sit alongside a custom amount input, selecting one clears the other, and the recharge button shows the exact amount that will be charged. Once an amount is chosen, a preview line shows what the balance will be after the top-up completes.

By Staaarter Team
Billing
Updated July 16, 2026
Docs
Live preview

Docs

Installation

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

npx shadcn add https://staaarter.com/r/billing-wallet-recharge.json

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

Usage

The file also exports billing149Demo, 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 { Billing149, billing149Demo } from "@/components/blocks/billing/billing149";

export default function Page() {
  return <Billing149 {...billing149Demo} />;
}

Props

PropTypeDefaultDescription
headingstring"Recharge wallet"Heading at the top of the card.
descriptionstringnoneOptional one-line note under the heading.
currentBalancenumbernoneCurrent wallet balance, shown top-right and used to compute the projected new balance.
currencySymbolstring"$"Symbol used in every formatted amount.
presetAmountsRechargeAmount[]noneQuick-select amount buttons shown in a 3-column grid.
defaultAmountIdstringpresetAmounts[0].idWhich preset is selected on first render.
minCustomAmountnumber5Minimum accepted value for the custom amount input.
maxCustomAmountnumber2000Maximum accepted value for the custom amount input.
paymentMethodLabelstringnoneOptional label shown bottom-left, e.g. "Visa •••• 4242".
ctaLabelstring"Recharge"Label on the recharge button, followed by the chosen amount.
classNamestringnoneExtra classes for the outer container.

Types

interface RechargeAmount {
  id: string;
  amount: number;
  bonus?: string;
}

Behavior notes

  • Selecting a preset clears the custom amount input, and typing in the custom input clears the preset selection, only one source of the amount is active at a time.
  • The custom amount is validated against minCustomAmount and maxCustomAmount; an inline message appears once the typed value is out of range, and the recharge button stays disabled.
  • The recharge button label appends the resolved amount (preset or custom) so the exact charge is visible before clicking.
  • The 'New balance after recharge' line only appears once a valid amount is resolved, it's computed locally as currentBalance plus the chosen amount and is not fetched from a server.
  • Clicking the recharge button does not call any payment API, wire it to your own Stripe (or other processor) flow and update currentBalance from the real result once the charge succeeds.

Frequently asked questions