Hi all !
I’m struggling with accessing, in Kotlin code, CSS attributes that contains “-” in name. Following code fails:
label { attrs.jsStyle.text-align = "center" }
How should I access “text-align” property through jsStyle ?
Hi all !
I’m struggling with accessing, in Kotlin code, CSS attributes that contains “-” in name. Following code fails:
label { attrs.jsStyle.text-align = "center" }
How should I access “text-align” property through jsStyle ?
Use backticks ( ` ), same as in Kotlin/JVM:
label { attrs.jsStyle.`text-align` = "center" }
Or cast to dynamic and use square brackets:
label { attrs.jsStyle.asDynamic()["text-align"] = "center" }