A template is a feature that allows users to define the structure of HTML that a SDK component displays. You can use this feature to fully customize any component. Templates can display any piece of data that the component has. There are different ways to display it, depending on your needs. The component data is represented in tags, as indicated by the brackets that surround them.
Example: {{ URL }}
and {{{ URL }}}
have different purpose but both show a URL.
Available tags vary from component to component because they depend on the data any given component has.
The syntax for this type is {{ attribute }}
.
This template shows the attribute converting tags to plain text and unescaping the HTML entities:
&
<
>
"
'
Example (using Semantic Autocomplete component)
Having
highlightedTitle: <strong>Example</strong> content
with the template
Title: {{ highlightedTitle }}
shows
Title: <strong>Example</strong> content
The syntax for this type is {{{ attribute }}}
.
This template shows the attribute as-is, unescaping the HTML entities:
&
<
>
"
'
Example (using Semantic Autocomplete component)
Having
highlightedTitle: <strong>Example</strong> content
with the template
Title: {{ highlightedTitle }}
shows
"Title: Example content"
The syntax for this type is attribute.property
.
This template refers to the property inside the attribute.
Example (using Semantic Autocomplete component)
Having
attributes: {
URL: http://www.example.com"
PARAGRAPHS: "Example content"
}
with the template
Link: {{ attributes.URL }}
shows
Link: htttp://www.example.com
The syntax for this type is {{=<% %>=}}
.
This template changes the default brackets delimiter to other characters. Useful for displaying the brackets as-is without interpretation.
Example (using Semantic Autocomplete component)
Having
title: Example content
with the template
{{=<% %>=}}
<% {{ title }} %>
shows
{{ title }}
For the complete list of tags and other information, refer to the Mustache documentation.