v0.20.230 - 27.9 / 9.1

toHTML

Turns any JSX-compatible value into concrete DOM nodes and returns them. Use it when you need actual Nodes in hand — for third-party libraries that want a DOM reference, for inserting into a DocumentFragment, or for custom rendering pipelines.

# Signature

# Arguments

nametypedescription
childrenany JSX valueelement, component, fragment, signal, array, promise — anything pota can render

Returns: a single Node when the input resolves to one root, or an array of Nodes when it resolves to several.

# toHTML vs render

  • render(children, parent?) mounts children into parent and returns a dispose function.
  • toHTML(children) just returns the nodes — you decide where and how to attach them.

Reactivity inside the returned nodes keeps working as long as the nodes stay together in the document. If you split them across containers, signals still update individual nodes, but structural helpers (like <For/>) expect the group to remain contiguous.

# Snippet