I'm attempting to dynamically apply a css class using a property. For
example I want to pass in a string:
<my-button kind="primary">some stuff</my-button>
My component looks like so:
class MyButton extends LitElement {
static get properties() {
return {
kind: String
}
}
constructor() {
super();
}
render({ kind }) {
return html`
<style>
.primary {
color: red;
}
</style>
<button on-click="${() => console.log('working')}"
class="${kind}"
type="button">
Press Me!
</button>
`
}
}
When I hard-code the class on the element it works. Any ideas?
Thanks!
Follow Polymer on Google+: plus.google.com/107187849809354688692
---
You received this message because you are subscribed to the Google Groups
"Polymer" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/polymer-dev/8f731c01-2f4d-470a-ac21-804d15050957%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.