Templating Language

Templates in Component.Studio 2 are anything inside of double braces. 

{{ }}

You can use templates anywhere you can type in text within a design or dataset except on names and quantities.

Template Language Features

Inside of a template, you can perform basic math functions like so:

{{ 2 + 2 }}

And the output in the rendered image will of course be 4.

You could also insert a string of text

Hello {{ 'Jim' }}

Which would output Hello Jim. Note that when you have a string of text it must apear inside a pair of half quotes ('text') or quotes ("text").

You can also use variables like this:

{{ row.name }}

You might even use two or more templates and variables within the same text box to create madlibs like this:

The {{ adjective }} {{ animal }} took a bite out of {{ person }}'s apple.

And even functions like this:

{{ upperCaseFirstLetter('jim') }}

And you can combine variables and functions like this:

{{ upperCaseFirstLetter(row.name) }}

Or even get into fancy programmer stuff like ternary conditions like this:

{{ 'red' if alert == 'red' else 'black' }}

There are many operators that allow you to do fancy things. For example, if you need to concatenate 2 strings together, do this:

{{ 'Armor ' + armor }}

And if you want to get crazy there are even multiple types of template formatting:

{# do not show this #}

As you can see the templating language is very powerful. Click on a link above to explore these topics further.

Still need help? Contact Us Contact Us