Staaarter

Billing Currency Switcher

A compact currency switcher for pricing pages, a row of currency codes as toggle pills and a large price that recalculates instantly when the user picks a different one. Prices are derived from a single base USD amount and a per-currency exchange rate you provide. Built for international SaaS pricing pages and global checkout flows where visitors expect to see a price in their own currency.

By Staaarter Team
Billing
Updated February 15, 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-currency-switcher.json

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

Usage

The file also exports billing42Demo, 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 { Billing42, billing42Demo } from "@/components/blocks/billing/billing42";

export default function Page() {
  return <Billing42 {...billing42Demo} />;
}

Props

PropTypeDefaultDescription
headingstring"Choose your currency"Heading shown above the toggle row.
descriptionstringnoneOptional supporting line under the heading.
basePriceUsdnumbernoneThe reference price in US dollars that every currency's rate is applied to.
currenciesCurrencyOption[]noneCurrencies rendered as toggle pills, in the order given.
defaultCurrencyCodestringcurrencies[0].codeWhich currency is active on first render.
periodstring"/mo"Suffix shown after the price, for example a billing interval.
classNamestringnoneExtra classes for the outer container.

Types

interface CurrencyOption {
  code: string;
  symbol: string;
  label: string;
  rate: number;
}

Behavior notes

  • The active currency is local component state, switching pills recalculates the displayed price as basePriceUsd times the selected currency's rate, with no page reload or refetch.
  • The price symbol is always shown as a prefix (for example "$49"); there's no suffix-symbol mode for currencies that conventionally place the symbol after the amount.
  • Amounts round to whole numbers when the result is an integer and to two decimal places otherwise, there's no per-currency decimal-place rule (for example JPY normally shows no decimals).
  • Selecting a currency doesn't persist anywhere by itself, save the chosen code to a cookie or localStorage yourself if you want it remembered across visits.

Frequently asked questions