One node of a StarView.Template tree.
| Kind | Fields | Rendering |
|---|---|---|
:text | value | Trusted static HTML source, emitted verbatim |
:value | value | HTML-escaped with Phoenix.HTML; a nested StarView.Template renders structurally |
:element | tag, attrs, children | A normal HTML element |
:branch | key, children | The chosen branch; key identifies which one |
:keyed | children | :fragment items, each with a unique key |
:fragment | children, optional key | Its children |
:component | value | A native StarView.Template; legacy HEEx results are rejected |
:text values and {:static, ...} attribute values are compiler output and
must already be entity-escaped source. They are never escaped again.
Compiled branch/collection children may hold internal programs before
materialization. StarView.Template.nodes/1 expands those into ordinary nodes.
Element meta
:void?-truefor void elements such as<br>; they render no closing tag and must have no children.:namespace-:svgor:mathmlfor foreign elements; defaults to HTML.:browser_owned?-truewhen browser code (a Rocket host, an editor) manages the element's descendants. Diffs never target those descendants.
Other meta (dependencies, source location) is free-form and ignored by rendering. Do not store a conn in meta.
Attributes
{:static, name, raw_value, delimiter}-raw_valueis entity-escaped source anddelimiteris"\""or"'". Anilvalue renders a bare boolean attribute.{:dynamic, name, value}- escaped like HEExname={value}:truerenders a bare attribute,nilandfalseomit it,classaccepts lists, andclass/styleare always emitted.{:spread, list_or_map}- escaped like HEEx{@rest}.
Dynamic and spread names are validated before rendering. Names containing
whitespace, quotes, <, >, /, =, & or backticks raise.
Summary
Functions
Builds a :branch node for the chosen branch key.
Builds a :component node.
Builds an :element node.
Builds a :fragment node, optionally keyed for item identity.
Builds a :keyed node from :fragment items.
Builds a :text node from trusted, already-escaped HTML source.
Builds a :value node.
Types
@type child() :: t() | StarView.Template.Program.t()
@type kind() :: :text | :value | :element | :branch | :keyed | :fragment | :component
Functions
Builds a :branch node for the chosen branch key.
@spec component(StarView.Template.t(), map()) :: t()
Builds a :component node.
Builds an :element node.
Builds a :fragment node, optionally keyed for item identity.
Builds a :keyed node from :fragment items.
Builds a :text node from trusted, already-escaped HTML source.
Builds a :value node.