summaryrefslogtreecommitdiff
path: root/examples/framework-multiple/src/components/LitCounter.js
blob: 883a7581da9adcd7af6c0f167058fdf5f29d9205 (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
33
import { LitElement, html } from 'lit';

export const tagName = 'my-counter';

class Counter 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(tagName, Counter);