---
title: "Multi-chain Swap | Free React & Tailwind Blocks Component | Motion UI"
canonical: "https://blacknest.dev/motion/c/blocks/swap"
github_source: "https://github.com/Rkj0123/motion-ui-skill/blob/main/components/motion/swap.tsx"
install_command: "npx motion-ui-skill add swap"
dependencies: ["clsx","lucide-react","motion","react","tailwind-merge"]
category: "blocks"
subcategory: "motion"
---

# Multi-chain Swap

> Cross-chain swap widget with chain + token selectors, morphing views, animated flip and quote.

## Install

```bash
npx motion-ui-skill add swap
```

## Dependencies

- `clsx`
- `lucide-react`
- `motion`
- `react`
- `tailwind-merge`

## Usage

```tsx
"use client";

import { MultiChainSwap } from "@/components/motion/swap";

export function SwapPreview() {
  return (
    <div className="flex w-full items-center justify-center">
      <MultiChainSwap />
    </div>
  );
}
```

## API Reference

### MultiChainSwap

| Prop | Type | Default | Required | Description |
| --- | --- | --- | --- | --- |
| `chains` | `Chain[]` | `[ { id: "eth", name: "Ethereum", tone: "bg-primary text-primary-foreground", symbol: "Ξ" }, { id: "sol", name: "Solana", tone: "bg-secondary text-secondary-foreground", symbol: "◎" }, { id: "base", name: "Base", tone: "bg-accent text-accent-foreground", symbol: "B" }, { id: "arb", name: "Arbitrum", tone: "bg-muted text-muted-foreground", symbol: "A" }, { id: "op", name: "Optimism", tone: "bg-destructive text-primary-foreground", symbol: "O" }, { id: "poly", name: "Polygon", tone: "bg-primary/80 text-primary-foreground", symbol: "P" }, { id: "bnb", name: "BNB", tone: "bg-secondary text-secondary-foreground", symbol: "B" }, { id: "avax", name: "Avalanche", tone: "bg-destructive/80 text-primary-foreground", symbol: "A" }, ]` | No | — |
| `tokens` | `Token[]` | `[ { id: "eth-eth", symbol: "ETH", name: "Ether", chainId: "eth", balance: 1.245, usd: 3142, popular: true, }, { id: "eth-weth", symbol: "WETH", name: "Wrapped Ether", chainId: "eth", balance: 0.5, usd: 3142, popular: true, }, { id: "eth-usdc", symbol: "USDC", name: "USD Coin", chainId: "eth", balance: 4521, usd: 1, popular: true, }, { id: "eth-usdt", symbol: "USDT", name: "Tether", chainId: "eth", balance: 2100, usd: 1, popular: true, }, { id: "eth-dai", symbol: "DAI", name: "Dai Stablecoin", chainId: "eth", balance: 800, usd: 1, popular: true, }, { id: "eth-wbtc", symbol: "WBTC", name: "Wrapped Bitcoin", chainId: "eth", balance: 0.04, usd: 96000, popular: true, }, { id: "eth-link", symbol: "LINK", name: "ChainLink Token", chainId: "eth", balance: 120, usd: 22, address: "0x51...86ca", trending: true, }, { id: "eth-aztec", symbol: "AZTEC", name: "AZTEC", chainId: "eth", balance: 0, address: "0xa2...62d2", trending: true, }, { id: "eth-cfg", symbol: "CFG", name: "Centrifuge", chainId: "eth", balance: 0, address: "0xcc...8a94", trending: true, }, { id: "eth-ondo", symbol: "ONDO", name: "Ondo", chainId: "eth", balance: 0, address: "0xfa...9be3", trending: true, }, { id: "sol-sol", symbol: "SOL", name: "Solana", chainId: "sol", balance: 12.4, usd: 168, }, { id: "sol-usdc", symbol: "USDC", name: "USD Coin", chainId: "sol", balance: 985.32, usd: 1, }, { id: "base-eth", symbol: "ETH", name: "Ether", chainId: "base", balance: 0.65, usd: 3142, }, { id: "base-usdc", symbol: "USDC", name: "USD Coin", chainId: "base", balance: 1200, usd: 1, }, { id: "arb-arb", symbol: "ARB", name: "Arbitrum", chainId: "arb", balance: 800, usd: 0.95, }, { id: "arb-eth", symbol: "ETH", name: "Ether", chainId: "arb", balance: 0.32, usd: 3142, }, { id: "op-op", symbol: "OP", name: "Optimism", chainId: "op", balance: 450, usd: 2.8, }, { id: "poly-matic", symbol: "MATIC", name: "Polygon", chainId: "poly", balance: 1500, usd: 0.75, }, { id: "bnb-bnb", symbol: "BNB", name: "BNB", chainId: "bnb", balance: 0, usd: 620, }, { id: "avax-avax", symbol: "AVAX", name: "Avalanche", chainId: "avax", balance: 0, usd: 38, }, ]` | No | — |
| `defaultFromId` | `string` | `eth-eth` | No | — |
| `defaultToId` | `string` | `sol-sol` | No | — |
| `className` | `string` | — | No | — |

## Source Files

- [components/motion/swap.tsx](https://github.com/Rkj0123/motion-ui-skill/blob/main/components/motion/swap.tsx)
- [components/motion/swap/constants.ts](https://github.com/Rkj0123/motion-ui-skill/blob/main/components/motion/swap/constants.ts)
- [components/motion/swap/controls.tsx](https://github.com/Rkj0123/motion-ui-skill/blob/main/components/motion/swap/controls.tsx)
- [components/motion/swap/data.ts](https://github.com/Rkj0123/motion-ui-skill/blob/main/components/motion/swap/data.ts)
- [components/motion/swap/field.tsx](https://github.com/Rkj0123/motion-ui-skill/blob/main/components/motion/swap/field.tsx)
- [components/motion/swap/quote-row.tsx](https://github.com/Rkj0123/motion-ui-skill/blob/main/components/motion/swap/quote-row.tsx)
- [components/motion/swap/token-badges.tsx](https://github.com/Rkj0123/motion-ui-skill/blob/main/components/motion/swap/token-badges.tsx)
- [components/motion/swap/token-picker.tsx](https://github.com/Rkj0123/motion-ui-skill/blob/main/components/motion/swap/token-picker.tsx)
- [components/motion/swap/types.ts](https://github.com/Rkj0123/motion-ui-skill/blob/main/components/motion/swap/types.ts)
- [components/motion/swap/utils.ts](https://github.com/Rkj0123/motion-ui-skill/blob/main/components/motion/swap/utils.ts)
- [lib/ease.ts](https://github.com/Rkj0123/motion-ui-skill/blob/main/lib/ease.ts)
- [lib/utils.ts](https://github.com/Rkj0123/motion-ui-skill/blob/main/lib/utils.ts)
