Skip to content

blikblum/raw-element

Repository files navigation

Raw Element

Raw Element is a base custom element class with reactive properties and a no-op render method

Features

    ✓ Based on UpdatingElement (Lit base class)
    ✓ No rendering engine. Override render method to update element

Installation

yarn add raw-element

Usage

import { RawElement } from "raw-element";

export class MyComponent extends RawElement {
  static get properties() {
    return {
      title: { type: String },
    };
  }

  render() {
    this.renderRoot.innerHTML = `<div>${this.title}</div>`;
  }
}

customElements.define("my-component", MyComponent);
<button type="button" onclick="toggleTitle()">Toggle title</button>
<my-component title="Hello!"></my-component>
<script>
  function toggleTitle() {
    document.querySelector("my-component").title = "New title";
  }
</script>

Examples

License

Copyright © 2022 Luiz Américo. This source code is licensed under the MIT license found in the LICENSE.txt file. The documentation to the project is licensed under the CC BY-SA 4.0 license.


Made with ♥ by Luiz Américo

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published