# EmailTemplateVariant type


The subject and bodies of a template for one language, or for every language without its own.

## Fields

### language

`String`

A language code from the locales catalogue. Null for the all-languages variant, used for every
language without a variant of its own.

### subject

`String`

The subject in Liquid, one line. Null only on a built-in template.

### htmlBody

`String!`

The HTML body in Liquid, exactly as written, at most 256 KiB.

Costs 50 points.

### textBody

`String`

The plain-text body in Liquid, exactly as written. Null when it is derived from the HTML at
render.

Costs 50 points.

### design

[`JSON`](/chameleoon-max/type/json)

A `JSON` template's block design. Null on an `HTML` template. At most 256 KiB, 500 blocks and 4
levels.

The shape, version 1, is a contract: it only grows (new optional keys, new block types). A
version, block type or key the API does not know is refused with `VALIDATION` and reason
`DESIGN_INVALID`. The shape is `{"version": 1, "layout": {...}, "blocks": [Block]}`.

`layout` (every key optional):

- `width` 480-680.
- `backdrop`, `canvas`, `textColor`, `linkColor` (`#rrggbb`).
- `font`: `ARIAL`, `HELVETICA`, `VERDANA`, `TAHOMA`, `TREBUCHET`, `GEORGIA`, `TIMES` or
  `COURIER`.
- `padding` 0-64.
- `preheader` (Liquid outputs).

A `Block` has:

- `id` (`[A-Za-z0-9_-]{1,32}`, unique) and `type`.
- An optional `show`: `{on: all|desktop|mobile, if: {all|any: [{var, op, value}]}}`. `var` is a
  field of the template's resource kind, `vars.<key>` or a repeat's item. `op` is `eq`, `ne`,
  `gt`, `gte`, `lt`, `lte`, `present` or `blank`.
- An optional `repeat`: `{list, as}`, where `list` is a `LIST` field, at most 2 deep.
- An optional `style`.
- The keys of its type.

The block types and their keys:

- `section`: `align`, `children`; style `background`, `padding`, `border`.
- `columns`: `columns` (2-4 of `{width 10-90, children}`, summing to 100), `stack`, `valign`;
  style `background`, `padding`, `gap`.
- `heading`: `level` 1-3, `text`, `align`; style `color`, `size`, `padding`.
- `text`: `html` (a few inline tags with Liquid outputs), `align`; style `color`, `size`,
  `lineHeight`, `padding`.
- `button`: `text`, `href`, `width` (`auto`|`full`|px), `align`; style `background`, `color`,
  `size`, `radius`, `padding`.
- `image`: `src` (an http(s) URL, a Liquid output or `asset:<uuid>` of a public asset), `alt`,
  `width`, `href`, `align`; style `padding`.
- `divider`: style `color`, `thickness`, `padding`.
- `spacer`: style `height`.
- `footer`: `align`; style `color`, `size`, `padding`.
- `html`: `html` (raw Liquid HTML, rendered unchecked).

Colours are `#rrggbb`, and `padding` is `[top, right, bottom, left]`, 0-80. `text`, `html`,
`href`, `alt`, `src` and `preheader` may hold Liquid output tags (double curly braces). Only
`html` blocks may hold Liquid `{% %}` tags.

Costs 50 points.

## Used by

- [`EmailTemplate`](/chameleoon-max/type/email-template)
