ui.util.id

Generate a unique identifier.

If value is provided, a UUID5 based on the value is generated, otherwise a random UUID4 is generated.

Call without arguments produces a different UUID every time:

{%- call ui.util.call(show_example) -%} {%- raw %} {{ ui.util.id() }} {%- endraw %} {%- endcall %}

When called with value, which is first positional argument, the same UUID is returned for every call:

{%- call ui.util.call(show_example) -%} {%- raw %} {{ ui.util.id("test") }} {%- endraw %} {%- endcall %}

By default, values are prefixed with id-. Prefix is controlled by prefix argument.

{%- call ui.util.call(show_example) -%} {%- raw %} {{ ui.util.id(prefix="custom-") }} {%- endraw %} {%- endcall %}