Skip to main content

Static HTML

Interprets a template literal as an HTML template that can efficiently render to and update a container.

Import

Signature

html(strings, values): TemplateResult<ResultType>

Parameters

strings
TemplateStringsArray
values
Array<unknown>

Details

Includes static value support from lit-html/static.js.

Interprets a template literal as an SVG template that can efficiently render to and update a container.

Import

Signature

svg(strings, values): TemplateResult<ResultType>

Parameters

strings
TemplateStringsArray
values
Array<unknown>

Details

Includes static value support from lit-html/static.js.

Wraps a string so that it behaves like part of the static template strings instead of a dynamic value.

Import

Signature

unsafeStatic(value): {_$litStatic$: string}

Parameters

value
string

Details

This is a very unsafe operation and may break templates if changes the structure of a template. Do not pass user input to this function without sanitizing it.

Static values can be changed, but they will cause a complete re-render since they effectively create a new template.

Wraps a lit-html template tag (html or svg) to add static value support.

Import

Signature

withStatic(coreTag): (strings: TemplateStringsArray, values: Array<unknown>) => TemplateResult<ResultType>

Parameters

coreTag
(strings: TemplateStringsArray, values: Array<unknown>) => TemplateResult<1> | (strings: TemplateStringsArray, values: Array<unknown>) => TemplateResult<2>