# Templates

With the recent 5.0 release, users are encouraged to make their own add-ons through the template process. This allows you to make complex elements usable with only a single tag. Templates are added to HTML Widget in the same way add-ons are (see [add-ons](/html-widget/add-ons/add-ons.md)) but without importing the file as you will create the template in the same file (if you choose, you can still make it as a module).

### Basic Add-on

```javascript
const tagName = {
  mapping: {},
  async render(template, styles, attrs, innerText) {
    await template(``);
  },
};
```

This piece of code declares the template substituted whenever the `tagName` tag is used.


---

# Agent Instructions: 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:

```
GET https://normal-tangerine8609.gitbook.io/html-widget/template/templates.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
