kotlinx.html icon indicating copy to clipboard operation
kotlinx.html copied to clipboard

Add htmlFor parameter to label element

Open JohannesOehm opened this issue 2 years ago • 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" 
}

JohannesOehm avatar Dec 27 '22 11:12 JohannesOehm

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

martinstender avatar May 23 '23 10:05 martinstender

thats my first solution, but written without linebreak.

JohannesOehm avatar May 23 '23 11:05 JohannesOehm