---
title: "Variables and render templates"
canonical_url: https://docs.zvid.io/docs/editor/templates/
source: docs/editor/templates.md
content_revision: 6338386a1dd87e4a
---

# Variables and render templates

Turn a composition into a reusable template by replacing changing content with variables.

## When to use it

Use a template when the layout stays the same but each output needs different text, images, products, or scene selections. A variable has a name and default value; a placeholder inserts that value into the composition.

## How to define and use a variable

**Navigation:** **Editor → Variables**.

1. Enter a name in **variableName**.
2. Choose **string**, **number**, **boolean**, **array**, or **object**, then click **Add**.
3. Enter a realistic default value. For arrays and objects, enter valid JSON and use **format** to format and apply it.
4. Click the variable's placeholder to copy it.
5. Paste it into a supported field, or use that field's variable insertion menu.
6. Enable **preview** in **Template variables** to show the resolved value on the stage.

![Zvid Variables panel with the preview toggle and controls to enter a variable name, choose its type, and add it.](https://docs.zvid.io/img/dashboard-guide/editor-variables.png)

For example, define a string named **title** and insert <code>{'{{title}}'}</code> into text. Object values can use dot paths such as <code>{'{{product.name}}'}</code>. A placeholder used alone can retain its value type; a placeholder inside a longer sentence becomes text.

## Preview variable values {#preview-toggle}

Enable **preview** in **Variables** to inspect the composition with its current defaults. The project keeps the raw placeholders when preview is enabled. Replacing a bound field with a literal value removes that field's placeholder.

## How to rename or delete variables

1. In **Variables**, inspect the usage count beside the variable.
2. Click **Rename**, enter the new name, and press Enter.
3. Update any placeholders that still use the previous name. Renaming the declaration does not automatically rewrite those references.
4. To remove a variable, click **Delete variable**. If it is still referenced, click again to confirm.

Deleting a referenced variable leaves unresolved placeholders until you remove or replace them. Review **Problems** after either action. For an undefined variable, click **define** and supply a safe default.

## How to repeat a scene for each array item

1. Add an **array** variable containing the items to render.
2. Open **Scenes** and select the scene to repeat.
3. In **Scene settings → Repeat for each item (iterate)**, select the array variable.
4. Set **Item alias** if you want a name other than **item**.
5. Use placeholders such as <code>{'{{item.title}}'}</code> for an item's fields and <code>{'{{index}}'}</code> for its position.
6. Review the repeat count on the scene card, then [preview the full movie](https://docs.zvid.io/docs/editor/preview/#how-to-preview-all-scenes).

The scene editing view previews the first array item. The full-movie preview expands the sequence using current defaults.

## How to show or hide content conditionally

1. Define a **boolean** variable with a safe default.
2. For a scene, open **Scenes → Scene settings → Condition**.
3. For a visual element in a video project, open **Timing → Template → Condition**. In an image project, the **Template** section is under **Design**.
4. Insert the variable placeholder.
5. Check the **on**, **off**, or **?** state indicator and resolve any missing variable.

A condition resolving to false, zero, or an empty value removes that content from the render. Editing views can keep conditionally hidden content selectable; use full-movie preview to inspect the resolved sequence.

## How to save a render template

**Navigation:** **Editor → account menu → Save as template**.

1. Sign in and finish defining defaults for every placeholder.
2. Click your account avatar, then **Save as template**.
3. In **Save as render template**, enter **Template name** and an optional **Description**.
4. Review the variable summary and resolve any missing-default warning.
5. Click **Save template**.
6. Copy the displayed template identifier, or follow **your dashboard** to manage it. Click **Done** to close the dialog.

The editor's **Save as template** creates a new template record. It is separate from **Save**, which updates a linked project draft. Saving a template validates the composition against your plan; saving a draft does not make it render-ready.

## Troubleshooting

### A placeholder is rejected or the template will not save

**Cause:** A referenced variable is missing, an expression is unsupported, JSON is invalid, or the composition fails a plan or payload check.

**Solution:** Open **Variables → Problems**, define missing defaults, and fix invalid JSON or references. Use simple names or dot paths rather than arbitrary expressions. Retry **Save template** and use the field details shown in its error message to correct remaining issues.

## What happens next

Use the template identifier with the API or integrations and supply per-render variable values. Creating the template does not render a video. A local preview shows values on the stage; the API's free template preview returns resolved JSON.

## Related documentation

- [Template basics and API rendering](https://docs.zvid.io/docs/templates/template-basics/)
- [Dynamic content](https://docs.zvid.io/docs/templates/dynamic-content/)
- [Bulk rendering](https://docs.zvid.io/docs/automation/bulk-rendering/)
- [Validate and estimate](https://docs.zvid.io/docs/validate-and-estimate/)
- [Save projects](https://docs.zvid.io/docs/editor/projects/)
