currency transfer.md

Currency Transfer

Transfer tracker that converts the amount in place, walks through each step on a filling rail and ends with a copyable reference.

Installation

npx shadcn@latest add @kokonutui/currency-transfer

Props

Prop Type Default Description
from? TransferAccount built-in Sending account and amount.
to? TransferAccount built-in Receiving account and amount. Its name labels the card.
rate? number 0.92 Units of to.currency per one unit of from.currency.
txnId? string "TXN-DAB3UL494" Transaction reference, copyable from the footer.
timestamp? string "10:45 AM" When the rate was locked, e.g. "10:45 AM".
status? TransferStatus Controlled status. While "processing" the steps run up to the last one and wait there. Leave unset for a demo that completes on its own.
locale? string "en-US" BCP 47 locale for amounts, symbols and the rate.
onRetry? () => void Shows a Retry button when the transfer has failed.
className? string Extra classes for the root element.

TransferAccount

Field Type Description
amount number Amount sent from / received into this account.
currency string ISO currency code, e.g. "USD".
symbol? string Short symbol, e.g. "$". Defaults to the currency's own symbol.
bank string Bank or account name, e.g. "Chase Bank".
last4? string Last digits of the account number, shown masked.
name? string Account holder, shown on the receiving side, e.g. "Lena Fischer".

TransferStatus

type TransferStatus = "processing" | "completed" | "failed";

Usage

With no props the card runs a demo: the payment is taken, converted, sent and arrives on its own. Pass status to drive it from your own transfer state. While status is "processing" the steps run up to the last one and wait there.

<CurrencyTransfer
  from={{ amount: 1200, currency: "GBP", symbol: "£", bank: "Monzo", last4: "1180" }}
  to={{ amount: 1404, currency: "USD", symbol: "$", bank: "Chase", last4: "4589", name: "Sam Carter" }}
  rate={1.17}
  txnId="TXN-8F2K19QZ"
  timestamp="2:30 PM"
  status={state}
  onRetry={retry}
/>

Status changes are announced to screen readers, and with reduced motion the digits, rail and ticks jump to their state.