0.1.2 • Published 3 years ago

reactive-widget v0.1.2

Weekly downloads
9
License
MIT
Repository
github
Last release
3 years ago

reactive-widget

A library for creating fast and reactive web components.

Minified Size Published On NPM

Getting Started

  1. Installation:

    run $ npm install reactive-widget.

  2. Creating your first widget:

    import { Widget, html, css } from 'reactive-widget';
    
    class MyWidget extends Widget {
      static get styles()  {
        return [
          css`
            span {
              color: green;
            }
          `;
        ]
      }
    
      initializeAttributes() {
        super.initializeAttributes();
        this.greetText = "Hello World!";
      }
    
      get template() {
        return html`<h1>${this.text}</h1>`;
      }
    }
    
    MyWidget.createAttributes({ greetText: String });
    MyWidget.createReactiveProperties(["greetText"]);
    MyWidget.register();
    <my-widget reactive-attribute="Woohoo!"></my-widget>