
Install
Quick start
App key
You must specify theappCode parameter when initializing the widget. This parameter is used to identify the source of orders. The key must be a UTF8 string of up to 50 chars. It will be a part of orders meta-data, see more in the CoW Protocol Docs.
Partner fee
You may participate in the Partner Fee program to collect fee on Market order trades executed by your users through the Widget by adding the following parameter to your Widget:Flexible config
Bothbps and recipient can be set for different chains and different trade types (swap/limit/advanced).
Bellow you can see the partnerFee configuration variations:
Advanced configuration
ThepartnerFee parameter can be set in a more advanced way using events. For example, you can define different fees for different assets:
Fee BPS
The fee in basis points (BPS). One basis point is equivalent to 0.01% (1/100th of a percent).The fee cannot exceed 1% (100 bps).
Recipient
The recipient is the address to which the fee will be sent. Make sure that the fee recipient address exists on the respective network defined in the parameters. For example, if you use a Safe as a recipient and the Safe was created on Ethereum mainnet, then for Gnosis Chain you must create another Safe and set it as a fee recipient. As a fee recipient, you can specify either string or a key-value pair in the formatchainId: recipientAddress:

Slippage configuration
The widget supports declarative slippage settings. This allows you to fine‑tune the minimum, maximum and default slippage per network.Types
Parameter
Add theslippage field to CowSwapWidgetParams:
partnerFee:
Behaviour & validation
| Rule | Description |
|---|---|
| Ranges | min ≥ 0, max ≤ 5000 (50 %), min ≤ defaultValue ≤ max, min < max |
| Defaults | If the user doesn’t specify a slippage, the widget falls back to defaultValue |
| Auto slippage | If the auto-slippage is less than or equal to defaultValue, the swap will use defaultValue |
| ETH‑Flow floor | When defaultValue < 200 bps (2 %) for Ethereum Mainnet or defaultValue < 50 (0.5 %) for other networks and the trade is ETH‑Flow, the widget will force the slippage to 2 %/0.5 % |
Example JSON (Configurator ready)
Wallet provider
You can pass the wallet provider from your application to seamlessly use the widget as part of your application. Also, you can not specify the provider, in this case the widget will work in standalone mode with the ability to connect any wallet supported in CoW Swap. A provider must comply with EIP-1193 and implement the interface:Configuration
CowSwapWidgetParams
All params are optional
| Parameter | Type | Default | Description |
|---|---|---|---|
width | string | 400px | The width of the widget in css values (px, vh, etc.). |
height | string | 600px | The height of the widget in css values (px, vh, etc.). |
maxHeight | number | --- | The widget automatically adjusts its height depending on the content. By default, the maximum height is body.offsetHeight, but it might be customized using the maxHeight parameter. |
appCode | string | --- | The unique identifier of the widget consumer. Please fill the for to let us know a little about you: https://cowprotocol.typeform.com/to/rONXaxHV. |
provider | EthereumProvider | --- | The Ethereum provider to be used for interacting with a wallet. To connect, for example, to Rabby Wallet or Metamask, just set window.ethereum. You also might like to use https://web3modal.com. |
chainId | number | 1 | The blockchain ID on which the trade will take place. Currently supported: 1 (Mainnet), 100 (Gnosis chain), 42161 (Arbitrum one), 8453 (Base), 11155111 (Sepolia). |
tradeType | TradeType | ’swap’ | The type of trade. Can be swap or limit or advanced. |
env | CowSwapWidgetEnv | ’prod’ | The environment of the widget (local , prod , dev , pr). See COWSWAP_URLS const value for urls. |
sell | TradeAsset | Same as in swap.cow.fi | An object containing information about the sell asset. Example: { asset: 'WBTC', amount: 12 } or { asset: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48' }. |
buy | TradeAsset | --- | An object containing information about the buy asset. Example: { asset: 'WBTC', amount: 12 } or { asset: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48' }. |
theme | CowSwapTheme | ’light’ | The theme of the widget ('dark' for dark theme or 'light' for light theme). It is also possible to set your own colors (CowSwapWidgetPalette). See Custom theme section for more details. |
sounds | CowSwapWidgetSounds | --- | The famous MOOO! sound can be changed to something else, just provide a link to a media file (mp3 or any other audio format supported by your browser). You can also specify a value of null to disable the sound. |
images | CowSwapWidgetImages | --- | To make your widget unique, you can replace some of the images. For example, a stub image when there are no limit orders. |
banners | CowSwapWidgetBanners | --- | With this option you can control the display of some banners in the CoW Swap interface. |
tokenLists | string[] | --- | CoW Swap uses the token lists standard, which allows flexible and decentralized management of assets for trading. Using this option you can set any token list you want. You also might want to use customTokens option for more flexible configuration. |
customTokens | TokenInfo[] | --- | In the case when you want to use tokens that are not included in the default token lists, you can add them programmatically by simply passing an array of ERC-20 tokens info. There is also tokenLists option to set a ready-made list of tokens. |
disableToastMessages | boolean | false | CoW Swap displays a pop-up notification when certain events occur, for example: an order has been filled. You may want to handle these events yourself and disable the display of notifications in the widget, to do this you need to enable this option. See Events handling section for more details. |
disablePostedOrderConfirmationModal | boolean | false | Disables showing the confirmation modal after posting an order. |
disableProgressBar | boolean | false | Disables showing the progress bar after a SWAP order is placed. |
disableCrossChainSwap | boolean | false | Disables cross-chain swaps (aka Swap and Bridge) feature. |
standaloneMode | boolean | false | When this option is enabled, the widget will use its own Ethereum provider and the user will be able to connect a wallet from within the widget. |
hideNetworkSelector | boolean | false | Disables an opportunity to change the network from the widget UI. |
hideLogo | boolean | false | Hides the logo in the widget. |
hideBridgeInfo | boolean | false | Hides bridge info in the swap form. |
hideOrdersTable | boolean | false | Hides orders table on limit and advanced forms. Warning! When true, users won’t be able to see their limit/twap order status or history, neither they’ll be able to cancel active orders. |
enabledTradeTypes | Array<TradeType> | All are enabled | CoW Swap provides three trading widgets: swap, limit and advanced orders. Using this option you can narrow down the list of available trading widgets. |
partnerFee | PartnerFee | --- | You can enable a fee for all trades in the widget. See Partner fee section for more details. |
forcedOrderDeadline | ForcedOrderDeadline | --- | Order deadline in minutes. Either a single value applied to each individual order type accordingly or an optional individual value per order type. The app will use the appropriated min/max value per order type. When set, user’s won’t be able to edit the deadline. Accepted values: single for all 123 OR per TradeType {"swap": 15, "limit": 666} OR per network {1: 35, 100: 5} |
slippage | SlippageConfig | --- | You can set up a slippage settings for all networks in the widget. See Slippage configuration section for more details. |
Custom theme
By setting custom colors you can very flexibly control the appearance of the widget. To do this, you need to pass an object of typeCowSwapWidgetPalette to the theme parameter.
You actually can specify only 2 or 3 basic colors, the rest of the palette is efficiently derived (also with the help of the color2k library to get ‘AA’ rated text/background color contrasts).
Example:

Custom tokens
CowSwap uses the token lists standard, which allows flexible and decentralized management of assets for trading. You can manage the list of tokens in CoW Swap UI:
- using
tokenListsparameter - using
customTokensparameter
tokenLists
In this parameter you can specify the URL or ENS address of the token list.
How to create and deploy your own token list you can find in the guide.
customTokens
If you want to use tokens that are not included in the default token lists, you can add them programmatically by passing an array of ERC-20 tokens info.
Events handling
The widget provides a bus of events that occur in the widget. Using it, you can receive notifications, for example, when an order has been executed or when an approval transaction has been mined. Separately, it is worth noting theON_TOAST_MESSAGE event; it occurs every time any notification is displayed in CoW Swap. To avoid double display of notifications, enable the disableToastMessages option in the widget configurations.
A list of all possible events can be found in the source code on Github.
Events usage example
Widget updating
You can change all possible widget options on the fly:Widget URL
Most of the widget parameters are controlled via the URL, which means that you can create the URL yourself and embed the iframe. An example of URL:Customization
Sounds
Images
In the example below, we replace the image that is displayed when there are no orders in the limit orders table. You can replace any image in the widget in the same way.
Banners
In some cases, you may want to hide some banners in the CoW Swap interface. To do this, you need to specify thebanners parameter in the widget configuration.
