summaryrefslogtreecommitdiff
path: root/examples/framework-lit/src/components/my-counter.js
blob: adc9e4a3d4bc1b8d5441b2aac683c641398d38a5 (plain) (blame)
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
27
28
29
30
31
32
import { LitElement, html } from 'lit';

export class MyCounter extends LitElement {
	static get properties() {
		return {
			count: {
				type: Number,
			},
		};
	}

	constructor() {
		super();
		this.count = 0;
	}

	increment() {
		this.count++;
	}

	render() {
		return html`
			<div>
				<p>Count: ${this.count}</p>

				<button type="button" @click=${this.increment}>Increment</button>
			</div>
		`;
	}
}

customElements.define('my-counter', MyCounter);