📱
HTML Widget
  • HTML Widget
  • Getting Started
    • Regular Use
    • Module Use
  • About
    • The Function
    • Types
  • Components
    • <widget>
    • <stack>
    • <spacer>
    • <img>
    • <text>
    • <date>
    • <style>
    • <!-- Comment -->
  • Add-ons
    • Add-ons
    • <symbol>
    • <hr>
    • <progress>
    • <blockquote>
  • Template
    • Templates
    • Mapping
    • Render
  • Examples
    • Hello, World!
    • Reddit Widget
  • Closing Remarks
    • Bug Fixes and Feedback
    • Support
Powered by GitBook
On this page
  1. Template

Templates

Template Introduction

Previous<blockquote>NextMapping

Last updated 2 months ago

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 ) 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

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.

add-ons