Lit Module¶
The lit
module provides the Lit HTML
library to the browser. You can use this module to take advantage of Javascript
Tagged Template Literals to render HTML into the DOM.
Since this is an external module, this documentation will not cover its architecture or layout. Learn more about Lit HTML and how its speed and features can make HTML templates easy.
This module is available directly from the namespace:
var lit = namespace.lit();
API¶
The lit
module's API provides the main capabilities of Lit HTML to namespaces.
This is done by providing their html
template function and their render
function.
html
¶
The html
method can be used to tag templates into actual HTML templates. It's
suggested to wrap this in a function to control scope of the variables the
template uses.
Learn more
Usage¶
// it's as easy as this:
lit.html`this is my ${template}`
// ... however we suggest this:
function myTemplate(params) {
return lit.html`this is my ${params.templateName}`
}
render
¶
The render
method can be used to render templates into an element in the DOM.
Learn more
Usage¶
lit.render(template, element);