Polymer/lit-html


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

https://lit-html.polymer-project.org/

License: BSD-3-Clause

Language: TypeScript


lit-html

Efficient, Expressive, Extensible HTML templates in JavaScript

Build Status Published on npm Join our Slack Mentioned in Awesome lit-html

Documentation

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.

Overview

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.

Installation

$ npm install lit-html

Contributing

Please see CONTRIBUTING.md.

Project Statistics

Sourcerank 18
Repository Size 3.24 MB
Stars 5,888
Forks 352
Watchers 222
Open issues 98
Dependencies 1,195
Contributors 90
Tags 17
Created
Last updated
Last pushed

Top Contributors See all

Justin Fagnani Justin Ridgewell Arthur Evans Keanu Lee Goffert van Gool Daniel Freedman Peter Burns Russell Bicknell Alexander Marks Steve Orvell Bram Gotink Christopher Joel Steven Traversi Michael Stramel Abdón Rodríguez Davila Kevin Schaaf PatrickJS zhaoz Zero Liu Brendan Baldwin

Packages Referencing this Repo

lit-html
HTML template literals in JavaScript
Latest release 1.1.2 - Updated - 5.89K stars
nlit-html
HTML template literals in JavaScript
Latest release 1.1.2 - Updated - 5.89K stars
@taoqf/lit-html
HTML template literals in JavaScript
Latest release 1.1.2 - Published - 5.89K stars
@durandj/lit-html
HTML template literals in JavaScript
Latest release 1.0.0-pre - Published - 5.89K stars
@festify/lit-html
HTML template literals in JavaScript
Latest release 0.9.1 - Published - 5.89K stars

Recent Tags See all

v1.1.2 August 12, 2019
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

Something wrong with this page? Make a suggestion

Last synced: 2020-01-25 16:24:02 UTC

Login to resync this repository