Skip to content

UziTech/web-component-abstract

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

web-component-abstract

Abstract class for creating web components with attributes bound to state.

Install

npm install --save web-component-abstract

Usage

JavaScript:

const Component = require("web-component-abstract");

class Hello extends Component({name: "World"}) {
	styles() {
		return "./style.css";
	}
	render() {
		const element = document.createElement("div");
		element.textContent = `Hello ${this.state.name}`;
		return element;
	}
}
Hello.define("my-hello");

HTML:

<my-hello name="Web Components"></my-hello>

Output:

Hello Web Components

About

Abstract class for creating web components

Resources

License

Stars

Watchers

Forks

Packages

No packages published