# Templates {#templates}


Templates are reusable email designs. Build them once with the drag-and-drop editor, then use them across campaigns and flows.


## Editor {#editor}


The visual editor uses a section-based layout. Drag components (text, images, buttons, dividers) into sections. Your brand theme is applied automatically.


## Personalization {#personalization}


Merge tags fill in each recipient's details when the email is sent. Insert them from the editor's merge tag menu, or type them:

```
Hi {{ contact.first_name }},
You're on the {{ data.plan | default: "free" }} plan.
Lifetime spend: {{ data.shopify.customers.amount_spent }}
```

- **Contact fields**: `contact.first_name`, `contact.last_name` and `contact.email`, plus profile fields such as `contact.company`, `contact.title` and `contact.total_spent`.
- **Custom fields**: `data.<key>` reads a field from the contact's `data` object (see [custom fields](https://docs.nitrosend.com/concepts/contacts.md#custom-fields)). Use dots for nested fields, for example `data.preferences.locale`.
- **Integration fields**: synced fields live under the integration's name, for example `data.shopify.customers.amount_spent`. They render in campaigns and flows; transactional messages render contact and custom fields only.
- **Fallbacks**: in campaigns and flows, a field the contact doesn't have renders empty. `{{ data.plan | default: "free" }}` renders `free` instead. Other filters include `upcase`, `capitalize`, `number`, `currency` and `date`.
- **Transactional sends**: every `data` field without a default must come from the send's `data` or the recipient's contact. A send missing one is refused when you make it, naming each missing field, and a dry run reports the same.

Values are HTML-escaped in the HTML version of the email, so a field can't add markup.


## MJML rendering {#mjml-rendering}


Templates are stored as structured JSON and rendered to MJML for maximum email client compatibility. You don't need to write any HTML.
