1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import { css, html, LitElement } from "https://esm.sh/lit@3.1.2";
export class SimpleGreeting extends LitElement {
static properties = {
name: {},
};
// Define scoped styles right with your component, in plain CSS
static styles = css`
:host {
color: blue;
}
`;
constructor() {
super();
// Declare reactive properties
this.name = "World";
}
// Render the UI as a function of component state
render() {
return html`<p>Hello, ${this.name}!</p>`;
}
}
customElements.define("simple-greeting", SimpleGreeting);
Val Town is a social website to write and deploy JavaScript.
Build APIs and schedule functions from your browser.
Comments
Nobody has commented on this val yet: be the first!
March 12, 2024