> For the complete documentation index, see [llms.txt](https://docs.wem.io/platform/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.wem.io/platform/template-editor/miscellaneous/nested-template.md).

# Nested template

## &#x20;![](/files/pI4nm111644qLIoBC51S)Introduction

Reusability has its inherent advantages&#x20;

* Create once and use in multiple places.
* Template Editor looks less cluttered and therefore easily understandable, particularly in cases where you have conditionals for multiple tabs in a tabbar.&#x20;
* When there is a change, you only have to make the change once in one temaple fragment, thereby removing the risk of missing the changes elsewhere when not using template fragments.&#x20;

It does not mean that you should use nested templates only for the purpose of reusability. You can use them even when there is no reusalibity, but just to declutter your Template Editor. &#x20;

## Prerequisites

To implement nested templates, you need to have template fragments created.&#x20;

{% hint style="info" %}
Refer the page for [Template fragments](/platform/wemmodeler/files-and-assets/template-fragments.md) if you would like to familarise yourself with the topic.
{% endhint %}

Nested templates are nothing but templates within templates - that is, one or more template fragments added on to an interaction template.&#x20;

if you know how to create template fragments, then creating nested templates is all about dragging and dropping them into the Template Editor.&#x20;

## Properties&#x20;

<figure><img src="/files/WfKHrV950vE9k2HAMkOT" alt=""><figcaption></figcaption></figure>

***Template -*** This refers to the Template Fragment choosen from the template fragments assets.&#x20;

***Visible when -*** This allows you to show/hide the Template Fragment based on certain conditions that you might want to set. However, the same result can also be achieved using Conditionals. And it is recommended to use Conditionals instead of this property, mainly because the condition is not hidden in the properties panel, but immediately visible to someone looking at the Template Editor. This improves readability.&#x20;

## Illustration

Let's build upon the EMS use case from where we had left at in the page for 'Tabbar'. We had built an interaction template with a Tabbar consisting of two tabs and Datagrids inside Conditionals that should be displayed based on the tab clicked.&#x20;

<figure><img src="/files/1pGGmyiiB3rhLhOfyLs6" alt=""><figcaption></figcaption></figure>

Let's try to replace the Datagrids with Template Fragements.&#x20;

1. In the Project Resources pane on your modeler, click on the tab corresponding to 'Templates, widgets, files and hyperlinks'. Create Template Fragments for 'Clients' and 'Projects'. The steps for creating the Template Fragements are not detailed out here. Refer the page linked in the prerequisites for further details on this topic.&#x20;

   <figure><img src="/files/V1ZNc4JxKKW58mQQouDC" alt=""><figcaption></figcaption></figure>
2. Let's remove the Datagrids from the Template Editor, so that we could use nested templates instead. &#x20;

   <figure><img src="/files/PwYO1WIKJpluzMVIgAQp" alt=""><figcaption></figcaption></figure>
3. Then, in the Template Editor, click on the 'Nested template' icon and drag it to the canvas. This would prompt you to select a Template Fragment. Select one and add it to the canvas. Do the step for adding both the Template Fragments.&#x20;

   <figure><img src="/files/7Y1EjjFdFEjOoeXQgOTL" alt=""><figcaption><p>Adding template fragment to interaction template</p></figcaption></figure>

Alternately, you could just drag and drop the Template Fragment from the library on to the canvas.&#x20;

4\. You have now nested these two Template Fragments into the Template Editor.&#x20;

<figure><img src="/files/sNifGKrI6XtufDpbn7HP" alt=""><figcaption><p>Nested templates</p></figcaption></figure>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.wem.io/platform/template-editor/miscellaneous/nested-template.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
