Skip to main content

Text Nodes

Sometimes it is necessary to have text nodes alongised regular html element children. One of these examples is implicit label association:

<label><input type=checkbox>Check This Out!</label>

In Nui this can look like this:

using Nui::Elements::label;

label{}(
input{
type = "checkbox"
},
// Do not forget the () at the end. Even though text nodes cannot have children,
// the parantheses are not optional for technical reasons.
text{"Check This Out!"}()
)

Text content can also be dynamic using Nui::Observed<std::string>.