summaryrefslogtreecommitdiff
path: root/examples/framework-lit/src/components/Counter.js
blob: c901096d54512cd4b955e488d031af18d9ebca08 (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
34
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);