Hi everyone! The html5 spec allows for arbitrary c...
# javascript
m
Hi everyone! The html5 spec allows for arbitrary custom tag names like <myPlaceholder/> Is there a way with the KotlinJS html builder to define arbitrary tag names like this? Having trouble finding an appropriate method. Thanks
b
Just use standard DOM API - window.createElement()
m
Ok thanks, wanted to check to make sure I wasn't reinventing the wheel 🙂
hmm, I can add the following and it works great:
Copy code
open class CUSTOM(tagName: String, initialAttributes : Map<String, String>, override val consumer : TagConsumer<*>)
    : HTMLTag(tagName, consumer, initialAttributes, null, false, false),
    HtmlBlockTag {

}

inline fun RBuilder.custom(tagName: String, classes: String? = null, block: RDOMBuilder<CUSTOM>.() -> Unit) = tag(block) { CUSTOM(tagName, attributesMapOf("class", classes), it) }
But looks like it's sibling types are all defined in kotlin-react-dom-legacy, and the newer kotlin-react-dom goes for generation instead of manual declaration of the builders. Think it's worth a pull request or are those legacy builders on their way out anyway?
t
Do you need custom React intrinsic type?
m
I'm not sure of that terminology, but I'm trying to use react-bootstrap, which has tags like <Row><Col> etc
Actually, I just realized those are even custom html tags, those are react jsx components. So my idea approach won't work anyway
maybe the best approach is to just use vanilla bootstrap-css and declare the class names in my react components
t
It looks like react components
m
Looks siimlar, but that appears to be a wrapper for a different ui framework: https://github.com/JetBrains/kotlin-wrappers/tree/e79251d9f6e86ded5a1f65c0d286b02035f5a7a5/kotlin-ring-ui
also found this wrapper for react-bootstrap, but it's incomplete, still in development: https://bjoernmayer.github.io/kotlin-react-bootstrap/