Skip to content

Instantly share code, notes, and snippets.

@Artur-
Last active August 13, 2020 11:46
Show Gist options
  • Save Artur-/d2405c800f3c286c096ae3c54d2b6f9b to your computer and use it in GitHub Desktop.
Save Artur-/d2405c800f3c286c096ae3c54d2b6f9b to your computer and use it in GitHub Desktop.
import { showNotification } from '@vaadin/flow-frontend/a-notification';
import '@vaadin/vaadin-button';
import '@vaadin/vaadin-text-field';
import { css, customElement, html, LitElement } from 'lit-element';
@customElement('hello-world-view')
export class HelloWorldView extends LitElement {
name: string = '';
static get styles() {
return css`
:host {
display: block;
padding: 1em;
}
`;
}
render() {
return html`
<vaadin-text-field label="Your name" @value-changed="${this.nameChanged}"></vaadin-text-field>
<vaadin-button @click="${this.sayHello}">Say hello</vaadin-button>
`;
}
nameChanged(e: any) {
this.name = e.target.value;
}
sayHello() {
showNotification('Hello ' + this.name);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment