Created
October 1, 2018 06:57
-
-
Save newbornfrontender/e788f6b52ad6ca352b44c35ce590fa3c to your computer and use it in GitHub Desktop.
Polymer - css properties
This file contains hidden or 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
<!doctype html> | |
<html> | |
<head> | |
<script src="https://unpkg.com/@webcomponents/webcomponentsjs@latest/webcomponents-loader.js"></script> | |
<title>App</title> | |
</head> | |
<body> | |
<script type="module"> | |
import { LitElement, html } from 'https://unpkg.com/@polymer/lit-element@latest/lit-element.js?module'; | |
class MyApp extends LitElement { | |
constructor () { | |
super(); | |
}; | |
static get properties () { return { | |
msg: { | |
type: String, | |
}, | |
color: { | |
type: String, | |
}, | |
}}; | |
render () { | |
const { color } = this; | |
return html` | |
<style> | |
span { | |
color: ${this.color}; | |
} | |
</style> | |
<h1>Hello <span>${this.msg}</span>!</h1> | |
`; | |
}; | |
}; | |
window.customElements.define('my-app', MyApp); | |
</script> | |
<my-app msg="world" color="red"></my-app> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment