wcb/examples/demo/Toggle.js
2024-12-19 22:43:12 +01:00

16 lines
345 B
JavaScript

import { WebComponent, html } from '../../src/index.js'
class Toggle extends WebComponent {
static props = {
toggle: false,
}
get template() {
return html`
<button onClick=${() => (this.props.toggle = !this.props.toggle)}>
${this.props.toggle}
</button>
`
}
}
customElements.define('my-toggle', Toggle)