Templating
Available helpers
Discover Handlebars helpers for efficient, logic-less templating.
Handlebars supports the use of helpers, which are custom functions that can be called within templates to perform specific transformations or logic based on the template data.
Build-in Helpers
Handlebars provides several built-in helpers which can be used to add logic to your templates. Here are some of the commonly used ones:
- if: Conditionally includes a block of template content.
- unless: The inverse of
if
. Includes a block of content if the expression evaluates to false.
- each: Iterates over an array, rendering the block once for each item.
- with: Provides a new context for the block within its current scope.
Additional helpers
In addition to the built-in helpers provided by Handlebars, we have added a couple more custom helpers to cater to specific needs and enhance the templating capabilities.
- compare: Compares two values using a specified operator.
Available operators are:
==
,===
,!=
,!==
,>
,>=
,<
,<=
,||
and&&
- json: Converts an object into a JSON string. Useful if you need to, for example, render charts with a JSON representation of your data. Checkout our reports example to see it in action.
Was this page helpful?