Package Exports
- lit
- lit/async-directive.js
- lit/decorators.js
- lit/decorators/custom-element.js
- lit/decorators/event-options.js
- lit/decorators/property.js
- lit/decorators/query-all.js
- lit/decorators/query-assigned-elements.js
- lit/decorators/query-assigned-nodes.js
- lit/decorators/query-async.js
- lit/decorators/query.js
- lit/decorators/state.js
- lit/directive-helpers.js
- lit/directive.js
- lit/directives/async-append.js
- lit/directives/async-replace.js
- lit/directives/cache.js
- lit/directives/choose.js
- lit/directives/class-map.js
- lit/directives/guard.js
- lit/directives/if-defined.js
- lit/directives/join.js
- lit/directives/keyed.js
- lit/directives/live.js
- lit/directives/map.js
- lit/directives/range.js
- lit/directives/ref.js
- lit/directives/repeat.js
- lit/directives/style-map.js
- lit/directives/template-content.js
- lit/directives/unsafe-html.js
- lit/directives/unsafe-svg.js
- lit/directives/until.js
- lit/directives/when.js
- lit/experimental-hydrate-support.js
- lit/experimental-hydrate.js
- lit/html.js
- lit/polyfill-support.js
- lit/static-html.js
Readme
Simple. Fast. Web Components.
Lit is a simple library for building fast, lightweight web components.
At Lit's core is a boilerplate-killing component base class that provides reactive state, scoped styles, and a declarative template system that's tiny, fast and expressive.
Documentation
See the full documentation for Lit at lit.dev
About this release
This is a stable release of Lit 2.0. If upgrading from previous versions of lit-element
or lit-html
, please see the Upgrade Guide for a step-by-step guide on upgrading.
Overview
Lit provides developers with just the right tools to build fast web components:
- A fast declarative HTML template system
- Reactive property declarations
- A customizable reactive update lifecycle
- Easy to use scoped CSS styling
Lit builds on top of standard web components, and makes them easier to write:
import {LitElement, html, css} from 'lit';
import {customElement, property} from 'lit/decorators.js';
// Registers the element
@customElement('my-element')
export class MyElement extends LitElement {
// Styles are applied to the shadow root and scoped to this element
static styles = css`
span {
color: green;
}
`;
// Creates a reactive property that triggers rendering
@property()
mood = 'great';
// Render the component's DOM by returning a Lit template
render() {
return html`Web Components are <span>${this.mood}</span>!`;
}
}
Once you've defined your component, you can use it anywhere you use HTML:
<my-element mood="awesome"></my-element>
Contributing
Please see CONTRIBUTING.md.