@biotope/element v2.0.1-alpha.0
Biotope Element
Installation
You can install the biotope element in your project using npm
npm install @biotope/element --saveor yarn
yarn add @biotope/element --saveimport Element from '@biotope/element';Usage
To use the biotope element, you have to extend it with your custom class:
import Element from '@biotope/element';
export class MyButton extends Element {
public static componentName = 'my-button';
public render() {
return this.html`Hello World`;
}
}After defining your class which you can do using existing methods (link) you have to call register on the class itself to use it in the html:
index.js
import Element from '@biotope/element';
export class MyButton extends Element {
public static componentName = 'my-button';
public render() {
return this.html`Hello World 🐤`;
}
}
MyButton.register();After that you can use it in your html like that: index.html
<script src="index.js"></script>
<my-button></my-button>This will result inthe following html:
<my-button>
Hello world 🐤
</my-button>6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago