> For the complete documentation index, see [llms.txt](https://book.just.money/jmguide/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://book.just.money/jmguide/justmoney-swap/widgets/single-chain/usage.md).

# Usage

**Format: JmApi.swapWidget(elementId, options);**

In this case iframe element must be created in HTML. You need to pass elementId to the function and it will attach to the correct element.

**Format: JmApi.createSwapWidget(element, options);**

This will create the iframe element. You need to pass "type" of the element in options object (see examples below). Type can be "SINGLECHAIN", "MULTICHAIN" or "CROSSCHAIN". If type is not passed "SINGLECHAIN" will be used as default.

Element can be ID of already existing element or an instance of an HTMLElement. It will be appended inside that element. If element does not exist it will be created with this given ID. If element is null, the element will be created with random ID.

Returns: ID of the iframe element.

**Parameters:**

* type: type of the widget ("SINGLECHAIN", "MULTICHAIN" or "CROSSCHAIN")
* network: the network that this widget is for. String if type is 'SINGLECHAIN', array if type is 'MULTICHAIN'
* slippage: slippage setting for the swap
* liquidityTab: can add or remove liquidity if set to true
* shadow: draw shadow under the widget element
* tokens: array of tokens to be visible on the swap widget UI. Empty array shows all tokens.
* fromToken: default token selected for 'from' field
* toToken: default token selected for 'to' field
* backgroundColor: background color of the widget. Can also be set to 'transparent'
* backgroundImage: background image of the widget
* textColor: main text color
* buttonStyle: large button style
* maxButtonStyle: style of the "max" button which is shown after user has connected to the widget
* inputContainerStyle: style of the input containers and dropdown elements
* headingStyle: style of the main heading
* lightBranding: JustMoney logo white when set to true, dark if set to false


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://book.just.money/jmguide/justmoney-swap/widgets/single-chain/usage.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
