Magoo Component UI logo Magoo Component UI
← Catalog

Swap Widget

swap-widget organism experimental

A token swap interface - a From panel, a To panel, a flip button between them, a rate line and a primary Swap action.

Also in: FormsCards

The width preview needs a screen wider than the chosen width — use a larger device (or a desktop browser) to see the desktop and tablet layouts.

Default
From Balance: 2.14 ETH
To Balance: 0 USDC
Rate 1 ETH = 3,150.42 USDC
Slippage tolerance 0.5%
Stablecoin
From Balance: 5,240 USDC
To
Rate 1 USDC = 0.9994 DAI
Slippage tolerance 0.5%

Props

NameTypeReq
from object ✓
to object ✓
rate string
slippage string

Related components

How to use

The panels, flip button, rate and slippage lines are static markup. behavior.js wires two actions: the Swap button fires swap:submit with the live from/to amounts and symbols read from the inputs, and the flip button fires swap:flip. The host page performs the swap and re-renders; the token pill buttons are placeholders for your own token picker.

Use cases

formcard WCAG AA SEO 20 dir: both ai-generated