# Variables

A [variable](@/tutorials/10-variables) is a named value the movie refers to
instead of hard-coding it. Declare `quote` once, write `{{quote}}` wherever the
text belongs, and the movie becomes a template you can render again and again
with different content.

The Editor separates the two halves of that idea: the **values** live in a panel
you use while designing, and the **schema** — what a variable is called, what type
it holds, how it is presented to whoever fills it in — lives in a dedicated
editor.

## The Variables panel

The **Variables** tab lists the movie's inputs with their current values:

![The Variables panel, listing each variable with its reference](@/images/editor/editor-variables-panel.png)

The values here are the **defaults**: what the movie uses in the preview, and what
a render uses for any variable the caller does not override. The grey
`{{ name }}` on the right of each row is the reference to copy into a field.

## Using a variable in a field

Any property can take its value from a variable instead of a fixed value. Click
the **`fx`** button next to the field and write the reference:

```
{{quote}}
```

The field then shows the expression rather than a value, and the canvas shows the
resolved result. The same mechanism accepts
[expressions](@/tutorials/12-expressions), so a field can compute rather than just
substitute.

When a reference does not produce what you expect, the **Inspector** panel shows
the resolved value of every variable at the current playhead position — including
inside a [repeated scene](@/guides/editor/repeat), where the values change from
one copy to the next.

## The schema editor

**Open full editor** in the Variables panel opens the schema — the template's
public input contract, which is what somebody filling in your template actually
sees:

![The variables schema editor](@/images/editor/editor-variables-schema.png)

The list on the left holds every variable, with how many places in the movie use
it and what type it holds. Selecting one opens its definition:

| Field | What it does |
|---|---|
| **Name** | The identifier used in `{{ }}` references |
| **Label** | The human-readable name shown to whoever fills in the template |
| **Description** | Help text shown under the field |
| **Type** | Text, number, boolean, object, array… |
| **Group** | Groups related fields together in the consumer form |
| **Default value** | The value used when the caller does not supply one |
| **Required** | Whether the template can be rendered without it |

Two tabs next to **Schema definition** show the consequences of what you just
declared: **Data form** previews the form a consumer will see, and **JSON preview**
shows the resulting schema.

The schema editor works on a draft. Nothing changes in the document until you
click **Save changes**, and the whole edit lands as a single undo step.

## Renaming and deleting safely

Renaming a variable in the schema editor rewrites every `{{ }}` reference to it in
the same step, so the movie keeps working. Deleting one that is still referenced
is blocked, with the usages listed — the count next to each variable in the list
is what that check is counting.

## See also

- [Repeating scenes](@/guides/editor/repeat) — arrays of objects, one copy per item.
- [Variables tutorial](@/tutorials/10-variables)
- [Expressions tutorial](@/tutorials/12-expressions)
