lit
    TypeScript icon, indicating that this package has built-in type declarations

    2.0.0-rc.2 • Public • Published

    Lit

    Simple. Fast. Web Components.

    Build Status Published on npm Join our Slack Mentioned in Awesome Lit

    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 release candidate of Lit 2.0 is intended to be feature complete and API stable. Please note the minor breaking changes from lit-element 2.0 and lit-html 1.0 in the lit.dev upgrade guide.

    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.

    Keywords

    none

    Install

    npm i lit

    Homepage

    lit.dev/

    DownloadsWeekly Downloads

    16,357

    Version

    2.0.0-rc.2

    License

    BSD-3-Clause

    Unpacked Size

    58.9 kB

    Total Files

    164

    Last publish

    Collaborators

    • avatar
    • avatar
    • avatar
    • avatar