Token Swap
Aave-style swap: animated amount, USD conversion, Max and Clear.
Import
tsx
import { TokenSwap } from "@cronus-ui/ui";
bash
npx cronus-ui add token-swap
Examples
API Reference
Generated from the component's exported types.
TokenSwapProps
Extends Omit< ComponentPropsWithoutRef<"div">, "defaultValue" | "onAnimationStart" | "onAnimationEnd" | "onDrag" | "onDragStart" | "onDragEnd" >
| Prop | Type | Default | Description |
|---|---|---|---|
ref | Ref<HTMLDivElement> | — | — |
from | TokenSwapAsset | — | — |
to | TokenSwapAsset | — | — |
usdPerFrom | number | DEFAULT_USD_PER_FROM | USD per 1 unit of the from-asset. |
toPerFrom | number | DEFAULT_TO_PER_FROM | To-asset units received per 1 unit of the from-asset. |
locale | string | "en-US" | — |
value | string | — | — |
defaultValue | string | "" | — |
onValueChange | (amount: string, parsed: number) => void | — | — |
labels | Partial<TokenSwapLabels> | — | — |