Kotlin/kotlinx.html

Add htmlFor parameter to label element

JohannesOehm opened this issue · 2 comments

Currently, you have to do:

checkBoxInput(classes = "form-check-input", name = "myName") {
    id = "myId"
    value = "myValue"
}

label(classes="myclass") {
  htmlFor="myId"
  +"Check me" 
}

However, a label without for attribute is not very common. It should be a parameter, so that it is much more concise to write:

label(classes = "myclass",  htmlFor = "myId") {
  +"Check me" 
}

Can't you just go:
label (classes = "") { attributes["for"] = "myId" +"Check me" }
?

thats my first solution, but written without linebreak.