An efficient, expressive, extensible HTML templating library for JavaScript.


License: BSD-3-Clause

Language: TypeScript


Efficient, Expressive, Extensible HTML templates in JavaScript

Build Status Published on npm Mentioned in Awesome lit-html


Full documentation is available at lit-html.polymer-project.org.

Docs source is in the docs folder. To build the site youself, see the instructions in docs/README.md.


lit-html lets you write HTML templates in JavaScript with template literals.

lit-html templates are plain JavaScript and combine the familiarity of writing HTML with the power of JavaScript. lit-html takes care of efficiently rendering templates to DOM, including efficiently updating the DOM with new values.

import {html, render} from 'lit-html';

// This is a lit-html template function. It returns a lit-html template.
const helloTemplate = (name) => html`<div>Hello ${name}!</div>`;

// This renders <div>Hello Steve!</div> to the document body
render(helloTemplate('Steve'), document.body);

// This updates to <div>Hello Kevin!</div>, but only updates the ${name} part
render(helloTemplate('Kevin'), document.body);

lit-html provides two main exports:

  • html: A JavaScript template tag 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.


$ npm install lit-html


Please see CONTRIBUTING.md.

Project Statistics

Sourcerank 18
Repository Size 3.01 MB
Stars 5,282
Forks 302
Watchers 219
Open issues 101
Dependencies 1,113
Contributors 84
Tags 16
Last updated
Last pushed

Top Contributors See all

Justin Fagnani Justin Ridgewell Keanu Lee Daniel Freedman Goffert van Gool Russell Bicknell Arthur Evans Alexander Marks Steve Orvell Christopher Joel Bram Gotink Steven Traversi Peter Burns Michael Stramel Kevin Schaaf zhaoz PatrickJS Brendan Baldwin Thomas Allmer graynorton

Packages Referencing this Repo

HTML template literals in JavaScript
Latest release 1.1.2 - Updated - 5.28K stars
HTML template literals in JavaScript
Latest release 1.1.1 - Updated - 5.28K stars
HTML template literals in JavaScript
Latest release 0.9.1 - Published - 5.28K stars
HTML template literals in JavaScript
Latest release 1.0.0-pre - Published - 5.28K stars

Recent Tags See all

v1.1.1 July 09, 2019
v1.1.0 May 21, 2019
v1.0.0 February 05, 2019
v1.0.0-rc.1 December 13, 2018
v0.14.0 November 30, 2018
v0.13.0 November 08, 2018
v0.12.0 October 05, 2018
v0.11.4 September 18, 2018
v0.11.3 September 13, 2018
v0.11.2 September 12, 2018
v0.11.1 September 04, 2018
v0.11.0 August 28, 2018
v0.10.2 June 14, 2018
v0.10.1 June 14, 2018
v0.10.0 May 04, 2018

Something wrong with this page? Make a suggestion

Last synced: 2019-08-12 17:51:10 UTC

Login to resync this repository