Skip to content

Instantly share code, notes, and snippets.

@khola
Last active March 7, 2018 09:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save khola/68433b341e04192e5f4c47f6ed1fd99e to your computer and use it in GitHub Desktop.
Save khola/68433b341e04192e5f4c47f6ed1fd99e to your computer and use it in GitHub Desktop.
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