Published
Edited
Mar 15, 2019
4 stars
Insert cell
Insert cell
MyElement = {
class MyElement extends lit.LitElement {
constructor() {
super();
this.mood = "sad";
}
static get properties() { return { mood: {type:"String"} }}

render() {
return lit.html`<style> .mood { color: green; } </style>Web Components are <span class="mood">${this.mood}</span>!`;
}
}
if(!window.customElements.get('my-element')) {
window.customElements.define('my-element', MyElement)
console.log("registered");
}
return MyElement
}
Insert cell
html`<my-element mood="happy"></my-element>`
Insert cell
Insert cell
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more