Unfortunately the implementation is likely incorrect and breaks <label for=…>. Also, there are way more attributes problematic in React than just for. This problem is not limited to a specific property but a more general issue.
The actual problem is that kotlinx.html is used in two different ways:
For building plain HTML. In that case HTML attribute names are used, so for is correct.
For use with React. In that case DOM attribute names are used, so htmlFor is correct.
Depending on if you use the library for (1) or (2), the required names and even the types of attributes are often different.
If you change for to htmlFor it will work in React but break for normal HTML. In its current state this library can only support one or the other. And it doesn't support React for now.
The alternative is to rework this library in a way that allows different attribute name mapping depending on the intended use of the HTML tree.
For that reason I've not used kotlinx.html when creating my own Kotlin React wrapper fluid-react.
Unfortunately the implementation is likely incorrect and breaks
<label for=…>
. Also, there are way more attributes problematic in React than justfor
. This problem is not limited to a specific property but a more general issue.The actual problem is that
kotlinx.html
is used in two different ways:for
is correct.htmlFor
is correct.Depending on if you use the library for (1) or (2), the required names and even the types of attributes are often different. If you change
for
tohtmlFor
it will work in React but break for normal HTML. In its current state this library can only support one or the other. And it doesn't support React for now. The alternative is to rework this library in a way that allows different attribute name mapping depending on the intended use of the HTML tree.For that reason I've not used
kotlinx.html
when creating my own Kotlin React wrapper fluid-react.