# lit-html **Repository Path**: mirrors_github/lit-html ## Basic Information - **Project Name**: lit-html - **Description**: HTML template literals in JavaScript - **Primary Language**: Unknown - **License**: BSD-3-Clause - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2020-08-08 - **Last Updated**: 2026-02-21 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # lit-html HTML templates, via JavaScript template literals [![Build Status](https://travis-ci.org/Polymer/lit-html.svg?branch=master)](https://travis-ci.org/Polymer/lit-html) ## Overview `lit-html` lets you write [HTML templates](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/template) with JavaScript [template literals](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals), and efficiently render and _re-render_ those templates to DOM. ```javascript import {html, render} from 'lit-html'; // This is a lit-html template function. It returns a lit-html template. const helloTemplate = (name) => html`
Hello ${name}!
`; // Call the function with some data, and pass the result to render() // This renders
Hello Steve!
to the document body render(helloTemplate('Steve'), document.body); // This updates to
Hello Kevin!
, but only updates the ${name} part render(helloTemplate('Kevin'), document.body); ``` `lit-html` provides two main exports: * `html`: A JavaScript [template tag](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals#Tagged_template_literals) used to produce a `TemplateResult`, which is a container for a template, and the values that should populate the template. * `render()`: A function that renders a `TemplateResult` to a DOM container, such as an element or shadow root. ### Announcement at Polymer Summit 2017

Efficient, Expressive, and Extensible HTML Templates video
Efficient, Expressive, and Extensible HTML Templates video

## Motivation `lit-html` has four main goals: 1. Efficient updates of previously rendered DOM. 2. Expressiveness and easy access to the JavaScript state that needs to be injected into DOM. 3. Standard JavaScript without required build steps, understandable by standards-compliant tools. 4. Very small size. ## How it Works `lit-html` utilizes some unique properties of HTML `