@tjmolinski/teds-element
Version:
Testing creating a web component with lit-element
27 lines (25 loc) • 766 B
JavaScript
// Import the LitElement base class and html helper function
import { LitElement, html } from 'lit-element';
// Extend the LitElement base class
class TedsElement extends LitElement {
/**
* Implement `render` to define a template for your element.
*
* You must provide an implementation of `render` for any element
* that uses LitElement as a base class.
*/
render(){
/**
* `render` must return a lit-html `TemplateResult`.
*
* To create a `TemplateResult`, tag a JavaScript template literal
* with the `html` helper function:
*/
return html`
<!-- template content -->
<p>Ted's Element</p>
`;
}
}
// Register the new element with the browser.
customElements.define('teds-element', TedsElement);