Package Exports
- lit-element
- lit-element/lit-element
- lit-element/lit-element.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (lit-element) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
lit-element
Implements lit-html via a LitElement class. Made for custom Elements.
Default Usage
// import html from lit-html
import {html} from '../node-modules/lit-html/lit-html.js'
// import lit-element
import LitElement from './lit-element.js'
// define Custom Element
class MyElement extends LitElement {
// define properties similiar to Polymer 2/3
static get properties() {
return {
title: String,
body: {
type: String,
value: 'That is a cool LitElement'
}
}
}
// define your template in render
render() {
this.title = 'This is lit';
return html`
<h1>${this.title}</h1>
<p>${this.body}</h1>
`;
}
}
Notes
- This Element does not use Polymer, just Polymer-like syntax for properties.
- Currently only
reflectToAttribute
andvalue
are supported for properties.