Swap – Composer Kit
Skip to content

Swap

Usage

The Swap component allows users to exchange tokens seamlessly.

Swap

Sell

Buy

Props

Swap

PropTypeDescription
childrenReact.ReactNodeThe child components of the Swap container.
className?stringOptional additional class names.

SwapToken

PropTypeDescription
swapableTokensSwapableTokens[]List of tokens available for swapping.
labelstringLabel for the SwapToken (e.g., "Sell", "Buy").
type"from" | "to"Defines whether it's a "from" or "to" swap token field.

SwapButton

PropTypeDescription
onSwapfunctionCallback function triggered when the swap button is clicked.
className?stringOptional additional class names.
onSwap Function Parameters:
({
  from: SwapableTokens | undefined,
  to: SwapableTokens | undefined,
  swapAmount: number,
  balanceResponse: {
    balance: string;
    error: string;
    response: UseReadContractReturnType;
  }
}) => void;