Templates

Template Introduction

With the recent 5.0 release, users are encouraged to make their own addons 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 addons are (see addons) but without the importing the file as you will create the template in the same file (if you chose, you can still make it as a module).

Declare the Function

const tagName = async (validate, template, update, styles, attrs, innerText) => {
}

This piece of code declares the function that will run whenever the tagName tag is used.

Parameters

validate

A function that validates the attributes and css.

template

The function that adds the template to the widget.

update

A function that fills all unused styles or attributes with "null".

styles

A JSON of the styles (css and attributes) for the tag with the names as the keys and values as the values.

attrs

A JSON of the attributes for the tag with the attribute names as the keys and values as the values.

innerText

A string of the inner text of the tag.

Last updated