Multi chain swap
BlockSwap one asset for another across networks, with a quote.
pnpm dlx shadcn@latest add https://caliperui.site/r/multi-chain-swap.jsonWhen to use #
Use it for
- Showing a swap with fees and route.
Skip it when
- The user hasn't checked the quote.
Installation #
pnpm dlx shadcn@latest add https://caliperui.site/r/multi-chain-swap.json
Adds its 10 files to components/ui/, each with its own stylesheet, and installs their packages. No account needed. The first part also adds Caliper UI’s tokens; import them once as in Installation.
Usage #
This is the code behind the preview above.
import { MultiChainSwap } from "@/components/ui/multi-chain-swap" const wait = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms)); export function MultiChainSwapDemo() { return ( <MultiChainSwap chains={[{ id: "eth", name: "Ethereum", minutes: 4 }, { id: "arb", name: "Arbitrum", minutes: 2 }, { id: "base", name: "Base", minutes: 2 }]} tokens={[ { symbol: "ETH", name: "Ether", price: 3120, balance: { eth: 1.8, arb: 0.4, base: 0 } }, { symbol: "USDC", name: "USD Coin", price: 1, balance: { eth: 940, arb: 1200, base: 310 } }, { symbol: "WBTC", name: "Wrapped Bitcoin", price: 64500, balance: { eth: 0.02, arb: 0, base: 0 } }, ]} onReview={async () => { await wait(800); }} /> ); }
API reference #
MultiChainSwap
component
Accessibility #
It exposes status semantics, with aria-label, aria-hidden and aria-busy kept in step with state. Changes that matter are announced through a live region.
Keyboard and focus handling comes from Radix popover: arrow keys move through items, Enter and Space select, and Escape closes and returns focus.
Motion #
It declares no animation in its component source. Any transition comes from its stylesheet, which uses the duration tokens that collapse to instant under prefers-reduced-motion.