> For the complete documentation index, see [llms.txt](https://sway-technologies.gitbook.io/sway-charts-pro-scripts-documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://sway-technologies.gitbook.io/sway-charts-pro-scripts-documentation/sway-charts-pro-user-defined-indicators/adding-html-to-the-chart/7.1-adding-html.md).

# 7.1	Adding HTML

You add HTML to the chart using UDI.createHTML(). For example:

```
UDI.createHTML({
	foreground: true,
	html: "<html><body>Hello!</body></html>"
});
```

A second call to UDI.createHTML() replaces the previous HTML with the new HTML. You can remove your HTML from the chart using UDI.removeHTML().

&#x20;

The options which are passed to UDI.createHTML() can contain the following properties. You must provide either the html or url.

| Property   | Description                                                                                                                                                                                                                                                                                                               |
| ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| html       | Text of the HTML to add; a complete document with \<html> and \</html> tags                                                                                                                                                                                                                                               |
| url        | URL of a web page to load. Standard browser security requires that this is hosted at a secure https\:// address.                                                                                                                                                                                                          |
| foreground | Controls whether the HTML is displayed in the background, behind the indicator drawing, or in the foreground. If your HTML includes elements for the user to interact with, such as buttons or fields, then you must set foreground:true.                                                                                 |
| style      | <p>Lets you set CSS style options on the iframe container, particularly the position. For example:</p><p>style: {opacity: 0.5, pointer-events: none}</p><p>You cannot set the position, which is always absolute (within its container). You cannot set zIndex, which is instead controlled by the foreground option.</p> |


---

# 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://sway-technologies.gitbook.io/sway-charts-pro-scripts-documentation/sway-charts-pro-user-defined-indicators/adding-html-to-the-chart/7.1-adding-html.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.
