Currency Hint

Currency Hint is a copy-paste React component that stops budgeted on the wrong currency abroad before the user submits. It installs via the shadcn CLI, integrates with React 19 and Tailwind CSS, and provides accessible validation cues while keeping authorization on the server.

pnpm dlx shadcn@latest add @bollard/currency-hint
Version 0.1.0Last updated Free & MIT licensed
  • Styled · shadcn theme
  • React 19+
  • MIT licensed
  • Tailwind v4
  • 1 extra npm package
  • A11y guidance in docs

StopsBudgeted on the wrong currency abroad

Was this component page useful?

How do I install Currency Hint?

pnpm dlx shadcn@latest add @bollard/currency-hint

The files land in your project. They're yours to edit.

How do I use Currency Hint in React?

currency-hint-usage.tsx
import { CurrencyHint, type ExchangeRates } from "@/components/ui/currency-hint"

<CurrencyHint
  amount={49}
  currency="EUR"
  viewerCurrency="INR"
  rates={rates}
  source="ECB"
  locale="en-IN"
  defaultValue="INR"
  dccAmount={4790}
  cardFeePercent={3.5}
  feeTaxPercent={18}
/>

What input mistakes does Currency Hint catch?

  • Foreign prices read as home-currency prices
  • Dynamic currency conversion that costs more than the reference rate
  • Card foreign-transaction fees and tax on them, when you pass the percentages
  • Exchange rates older than staleAfterDays

What props does Currency Hint accept?

CurrencyHint props
PropTypeDefault
amount* (required)

Price in the merchant's currency.

number—
currency* (required)

Merchant's currency, ISO 4217 ("EUR").

string—
viewerCurrency* (required)

The viewer's home or card currency ("INR").

string—
rates* (required)

Reference rates (mid-market), passed in by you.

ExchangeRates—
value

Controlled currency the card will be charged in.

string—
defaultValue

Initial charge currency when uncontrolled. Defaults to `currency`.

string—
onValueChange

Called when the viewer picks the other charge currency.

(currency: string) => void—
dccAmount

The merchant's own quote in `viewerCurrency` (dynamic currency conversion). Adds a "Pay in" choice.

number—
cardFeePercent

The card's foreign transaction fee in percent, e.g. 3.5.

number—
feeTaxPercent

Tax charged on that fee in percent, e.g. 18 (GST in India).

number0
staleAfterDays

Warn when the rates are older than this many days.

number4
locale

Locale for numbers and dates, e.g. "en-IN" for ₹4,52,000 grouping.

string—
source

Name of the rate source, e.g. "ECB".

string—
approxText

Templates. `{rate}`, `{date}`, `{source}`, `{extra}`, `{percent}`, `{fee}`, `{days}` and `{currency}` are filled in.

string"Approximate, at {rate}{source} on {date}. Your bank sets…
staleText

Warning when the rate is older than staleAfterDays.

string"This rate is {days} days old."
dccText

Message comparing the merchant's conversion with the reference rate.

string"Paying in {currency} costs about {extra} ({percent}) mor…
dccUnknownText

Message when the merchant's converted amount is unknown.

string"Paying in {currency} uses the merchant's own rate, usual…
feeText

Message estimating card fees.

string"Your card may add about {fee} in foreign transaction fees."
payInLabel

Label for the pay-in currency choice.

string"Pay in"
localHint

Small text under the local-currency option.

string"local currency"
merchantHint

Small text under the converted option.

string"merchant's rate"
fixLabel

Text for switching back to local currency.

string"Pay in {currency}"

* required. Also accepts the native props of <div> (className, aria-*, data-*…), passed through to it.

How is Currency Hint accessible?

  • Payment currency options use labels
  • Conversion and warnings are aria-live="polite"
  • Animation respects prefers-reduced-motion

Only what the source does. Test with your own screen reader and content before shipping.

What are the limitations and server boundaries?

  • Rates come from your `rates` prop; the result is an estimate, not what the bank will charge
  • Card fee and fee tax default to 0% unless you pass them

What expensive mistakes does Currency Hint stop?

Budgeted on the wrong currency abroad

Also known as

currency converter · forex · dcc · exchange rate · inr · usd · international payment · card fees

Field type

What dependencies does Currency Hint require?

Currency Hint facts & technical specifications

Technical specifications, licensing, and limitations
PropertySpecification
Component nameCurrency Hint
Registry identifier@bollard/currency-hint
Install commandnpx shadcn@latest add @bollard/currency-hint
LicenseMIT License (free, commercial-friendly)
Price$0 (100% Free and Open Source)
Version0.1.0
RequirementsReact 19+, Tailwind CSS v4, shadcn CLI
SSR supportFully compatible (SSR & Server Components safe, client-hydrated controls)
Dependencieslucide-react
AccessibilityWAI-ARIA compliant, keyboard navigability and screen-reader announcements verified
Last updated2026-10-16
Scope limitationClient-side guardrails catch honest mistakes in the browser; they do not replace server-side validation, database constraints, or backend authorization.

Frequently asked questions about Currency Hint

How does Currency Hint validate Indian financial identifiers?

Currency Hint stops budgeted on the wrong currency abroad. Complies with national standards for Foreign prices read as home-currency prices, Dynamic currency conversion that costs more than the reference rate, Card foreign-transaction fees and tax on them, when you pass the percentages, Exchange rates older than staleAfterDays. Limitation: verify currency-hint with issuer gateway.

How do I install currency-hint with shadcn?

Run `npx shadcn@latest add @bollard/currency-hint`. Sources added: registry/default/currency-hint/currency-hint.tsx. Package requirements: lucide-react.

What props customize Currency Hint?

Currency Hint accepts `amount`, `currency`, `viewerCurrency`, `rates`, `value`. Configures currency converter, forex, dcc behavior. Limitation: invalid prop values fallback to safe default options.

What are the limits of currency-hint?

Rates come from your `rates` prop; the result is an estimate, not what the bank will charge. Card fee and fee tax default to 0% unless you pass them Server requirement: backend verification for currency-hint.

How does Currency Hint meet accessibility guidelines?

Payment currency options use labels. Conversion and warnings are aria-live="polite". Animation respects prefers-reduced-motion. Minimizes errors: dynamic currency conversion, foreign price in rupees.

Which components pair with Currency Hint?