Skip to content

Currency Swap

Pro

Swap or convert money, coins, metals, and points, or buy on a schedule. It shows a live price and the costs, then a review, each step, and the receipt.

  • Base UI
  • React Aria
  • Motion
  • React 19
  • Tailwind CSS 4

Added Nov 12, 2026 · Pro license

Playground

Loading the preview

Props

Needs your Pro API key in GELATIN_UI_PRO_TOKEN. Set it up

Pro itemAPI key required

Currency Swap needs a Pro API key

Try the live preview for free. With Pro, the add command above puts the source in your project.

Files it adds
162
More Pro items, one API key
+327
Your coding agent runs it
1 cmd

$79$129once, for life

Already have Pro? Sign in to set up your API key.

Put the fields, the switch, the quote, and Submit in the swap, then the status, the receipt, and the review of the confirm flow.

swap-panel.tsx

CurrencySwap

<div>
PropTypeDefaultDescription
size"default""sm"—
value—The form value (controlled): the amount, its side, both asset ids, and the mode.
defaultValue—The form value at first (uncontrolled); missing fields take the defaults.
onValueChange—People changed the form value: typed, picked, switched, or a new mode. eventDetails.reason says which; eventDetails.cancel keeps the value it had.
assetsRequired—Every asset people can pick, on both sides.
balances—What the wallet holds, decimal strings by asset id.
prices—The price of 1 unit of each asset in currency, for value lines without a quote.
currencystring—The ISO 4217 code of the values. Default "USD".
getQuoteRequired—The price source. Called after a typing pause and every holdMs; abort on signal.
onConfirm—Sends the swap, the order, or the plan: a stream of statuses, or one promise.
settings—
defaultSettings—
onSettingsChange—
confirm"inline-hold""inline-slide""review"—How people confirm. Default review.
holdMsnumber—How long a price holds before it refreshes, in ms. Default 15 000.
slowAfterMsnumber—A sent swap past this many ms shows "takes longer". Default 120 000.
recentreadonly string[]—Ids of the assets picked last, newest first, for the picker.
assetsStatus"empty""error""loading""ready"—The status of the asset list, for the picker.
onAssetsRetry—
onSearch—Finds an unlisted token by a pasted address (Asset Picker onSearch).
localestring—
labels—
container—Where every popup portals to (the settings, the asset pickers, the date pickers, the Review): Base UI Portal container, so a scoped app or a playground keeps them in its frame. Default: the document body.
childrenReactNode—The parts. The root adds Status, Receipt, and Review when the parts leave them out.
From Base UIUseRenderBase UI docs
render—Allows you to replace the component's HTML element with a different tag, or compose it with another component. Accepts a ReactElement or a function that returns the element to render.
...props<div> attributes—Every other attribute goes to the <div>, with a ref.

CurrencySwapField

<div>
PropTypeDefaultDescription
sideRequired"pay""receive"—The side this panel holds.
From Base UIUseRenderBase UI docs
render—Allows you to replace the component's HTML element with a different tag, or compose it with another component. Accepts a ReactElement or a function that returns the element to render.
...props<div> attributes—Every other attribute goes to the <div>, with a ref.

CurrencySwapAmount

<div>
PropTypeDefaultDescription
maxFontSizenumber—The text size while the whole value fits, in px. Default 56.
minFontSizenumber—The smallest text size, in px. Past it the field scrolls to the caret. Default 24.
align"center""start"—Where the value sits in the field: center (default) or start.
rejectFeedbackboolean—Nudge the value 2px when the mask rejects a key. Default true.
onReject—Runs when the mask rejects a key (a letter, a third decimal, a digit past max).
rawNamestring—Also submit the raw value under this name (a hidden input), next to the shown one.
classNamestring—Classes of the root box (its width is the room the value fits in).
refRef<HTMLInputElement>—
...props<div> attributes—Every other attribute goes to the <div>.

CurrencySwapDetailsRow

<div>
PropTypeDefaultDescription
labelRequiredstring—The name of the row ("Network cost").
...props<div> attributes—Every other attribute goes to the <div>, with a ref.
  • Use it for a swap, a money conversion, a limit order, or a recurring buy.
  • Give getQuote and onConfirm; the machine owns the amounts, the quote, and the flow.
  • Pick confirm: review (a dialog), inline-slide, or inline-hold.
Switch
panel · the arrows turn half a turn and the sides trade
Quote, details, and notes
panel · each row folds open and closed in place, on the shortest clock that keeps 15px a frame
Limit price and schedule
theme · the panel of the mode folds open
Waiting side
fade · the side that waits for a price fades to half
  1. AddedCurrency Swap, with Asset Picker, Auto Scale Input, Currency Swap Review, Swipe to Confirm, Alert, Button, Circular Progress, Collapsible, Date Input, Date Picker, Frame, Hold Button, Label, Number Field, Popover, Segmented Control, Spinner, Switch, Tabs, Toggle Group.
Open the release