NodeBuilder

Builder for a single Node of element type, collecting its props and children.

As an ElementSink it also accepts the HTML tag helpers, which append built nodes as children.

Constructors

Link copied to clipboard
constructor(type: String)

Functions

Link copied to clipboard
fun addChild(child: <Error class: unknown class>)

Appends child to this node's children, marking the children list as present.

Link copied to clipboard
open override fun addElement(node: <Error class: unknown class>)

Appends node as an element child; the ElementSink entry point used by the tag helpers.

Link copied to clipboard
fun build(): <Error class: unknown class>

Builds the Node. Node.children is null when no child was added (distinct from an empty list), preserving the spec's absent-vs-empty distinction.

Link copied to clipboard
fun ElementSink.div(block: NodeBuilder.() -> Unit = {})

Appends a div element to this sink.

Link copied to clipboard
fun extras(key: String, value: <Error class: unknown class>)

Sets an unknown sibling key on the node, preserved verbatim in Node.extras under key.

Link copied to clipboard
fun ElementSink.h1(block: NodeBuilder.() -> Unit = {})

Appends an h1 heading element to this sink.

Link copied to clipboard
fun ElementSink.h2(block: NodeBuilder.() -> Unit = {})

Appends an h2 heading element to this sink.

Link copied to clipboard
fun ElementSink.h3(block: NodeBuilder.() -> Unit = {})

Appends an h3 heading element to this sink.

Link copied to clipboard
fun ElementSink.h4(block: NodeBuilder.() -> Unit = {})

Appends an h4 heading element to this sink.

Link copied to clipboard
fun ElementSink.h5(block: NodeBuilder.() -> Unit = {})

Appends an h5 heading element to this sink.

Link copied to clipboard
fun ElementSink.h6(block: NodeBuilder.() -> Unit = {})

Appends an h6 heading element to this sink.

Link copied to clipboard
fun ElementSink.img(block: NodeBuilder.() -> Unit = {})

Appends an img element to this sink.

Link copied to clipboard
fun node(type: String, block: NodeBuilder.() -> Unit = {})

Appends a nested element child of the given type, built via a fresh NodeBuilder.

Link copied to clipboard
fun nullChild()

Appends a JSON null child (ChildNode.Null).

Link copied to clipboard
fun number(value: Number)

Appends a numeric child (ChildNode.Numeric), stored as a Double.

Link copied to clipboard
fun ElementSink.p(block: NodeBuilder.() -> Unit = {})

Appends a p (paragraph) element to this sink.

Link copied to clipboard
fun props(block: NodePropsBuilder.() -> Unit)

Configures this node's NodeProps (id, classes, style, event bindings) via NodePropsBuilder.

Link copied to clipboard
fun ElementSink.span(block: NodeBuilder.() -> Unit = {})

Appends a span element to this sink.

Link copied to clipboard
fun text(value: String)

Appends a text child (ChildNode.Text).

Link copied to clipboard
operator fun <Error class: unknown class>.unaryPlus()

Appends this ChildNode as-is.

operator fun <Error class: unknown class>.unaryPlus()

Appends this Node as an element child (ChildNode.Element).

operator fun String.unaryPlus()

Appends this string as a text child (ChildNode.Text).