WebComponent.io: Write web components in Easy Mode. {{ project.name }} {{ project.description }}

By extending our base class, you get an easy authoring experience as you would expect in writing your components:

Version 2.0.0-beta is out! 🎉

We are now able to attach "side effects" to property value changes, from inside the component and outside.

Play on CodePen.


When you extend the WebComponent class for your component, you only have to define the template and properties. Any change in any property value will automatically cause just the component UI to render.

The result is a reactive UI on property changes:

import WebComponent from "https://unpkg.com/web-component-base@1.13.0/WebComponent.min.js";

export class Counter extends WebComponent {
  static properties = ["count"];
  onInit() {
    this.props.count = 0;
    this.onclick = () => ++this.props.count;
  }
  get template() {
    return `<button>${this.props.count}</button>`;
  }
}

customElements.define("my-counter", Counter);
          
This site is built with McFly, the no-framework framework;
✨ Star on GitHub to support;
A project by {{ author.name }}