ui.util.tag

Helper method to render an HTML tag with the specified content, tag name, and attributes.

{%- call ui.util.call(show_example) -%} {%- raw %} {{ ui.util.tag("Content", "h2") }} {%- endraw %} {%- endcall %}

Empty tag name will render content without any wrapper - this can be used to apply wrapper conditionally. For example, ui.util.tag(content, tag if condition else "") will render content wrapped in tag if condition is truthy, and just content without wrapper otherwise.

{%- call ui.util.call(show_example) -%} {%- raw %} {{ ui.util.tag("Content", "") }} {%- endraw %} {%- endcall %}

ui.uti.tag takes into account additional named arguments and processes them using ui.util.attrs:

{%- call ui.util.call(show_example) -%} {%- raw %} {{ ui.util.tag("click", "button", attrs={"style": "background: lime;font-size: 2rem;"}, on={"click": "alert(1)"}) }} {%- endraw %} {%- endcall %}