Last active
March 7, 2018 09:51
-
-
Save khola/68433b341e04192e5f4c47f6ed1fd99e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Component, Prop, State } from '@stencil/core'; | |
@Component({ | |
tag: 'my-custom-button', | |
styleUrl: 'my-custom-button.scss' | |
}) | |
export class MyCustomButtonComponent { | |
@Prop() myCustomAttribute: string; | |
@State() checked: boolean; | |
toggleChecked(event: UIEvent) { | |
this.checked = !this.checked; | |
} | |
render() { | |
return ( | |
<div onClick={(event: UIEvent) => this.toggleChecked(event)}> | |
<span className={(this.checked && "checked")}></span> | |
{this.myCustomAttribute} | |
</div> | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment