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>| Prop | Type | Default | Description |
|---|---|---|---|
| size | "default""sm" | — | |
| value | — | The form value (controlled): the amount, its side, both asset ids, and the mode. | |
| default | — | The form value at first (uncontrolled); missing fields take the defaults. | |
| on | — | People changed the form value: typed, picked, switched, or a new mode. eventDetails.reason says which; eventDetails.cancel keeps the value it had. | |
| assets | — | 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. | |
| currency | string | — | The ISO 4217 code of the values. Default "USD". |
| get | — | The price source. Called after a typing pause and every holdMs; abort on signal. | |
| on | — | Sends the swap, the order, or the plan: a stream of statuses, or one promise. | |
| settings | — | ||
| default | — | ||
| on | — | ||
| confirm | "inline-hold""inline-slide""review" | — | How people confirm. Default review. |
| hold | number | — | How long a price holds before it refreshes, in ms. Default 15 000. |
| slow | number | — | A sent swap past this many ms shows "takes longer". Default 120 000. |
| recent | readonly string[] | — | Ids of the assets picked last, newest first, for the picker. |
| assets | "empty""error""loading""ready" | — | The status of the asset list, for the picker. |
| on | — | ||
| on | — | Finds an unlisted token by a pasted address (Asset Picker onSearch). | |
| locale | string | — | |
| 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. | |
| children | ReactNode | — | 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>| Prop | Type | Default | Description |
|---|---|---|---|
| side | "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>| Prop | Type | Default | Description |
|---|---|---|---|
| max | number | — | The text size while the whole value fits, in px. Default 56. |
| min | number | — | 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. |
| reject | boolean | — | Nudge the value 2px when the mask rejects a key. Default true. |
| on | — | Runs when the mask rejects a key (a letter, a third decimal, a digit past max). | |
| raw | string | — | Also submit the raw value under this name (a hidden input), next to the shown one. |
| class | string | — | Classes of the root box (its width is the room the value fits in). |
| ref | Ref<HTMLInputElement> | — | |
| ...props | <div> attributes | — | Every other attribute goes to the <div>. |
CurrencySwapDetailsRow
<div>| Prop | Type | Default | Description |
|---|---|---|---|
| label | string | — | The name of the row ("Network cost"). |
| ...props | <div> attributes | — | Every other attribute goes to the <div>, with a ref. |
Built with
Installs with Currency Swap
- Components
- Asset Picker,Auto Scale Input,Currency Swap Review,Swipe to Confirm,Alert,Button,Circular Progress,Collapsible+ 12 more













