Skip to main content
The editor and the engine build every email from a design system. By default that’s the Ultimate Email Design System, which is built in. You can pass your own, or add your own components to it. This page is a summary. The full reference is FORMAT.md in the repository. checkDesignSystem(designSystem) from @email-love/core/format tells you what’s wrong with a design system, in words.

The built-in design system

starterDesignSystem() from @email-love/core/starter is the Ultimate Email Design System: its tokens and all 217 components, as a new Email Love account gets it. starterEmails() gives the four emails made from it. It’s also free on Figma. Most of its pictures are on Email Love’s CDN. A few, like its logo and social icons, are served from https://app.emaillove.com. To serve those yourself, copy them and pass assetBase: 'https://your.host'. The same option sets where the carousel and accordion icons come from. In the editor, leave out designSystem to use it. It’s only loaded then.

Documents

An email is a document:
  • Each block names a component by its key and version, and holds its own field values.
  • A field the block doesn’t hold takes the component’s default.
  • lang (a language code) and dir (ltr, rtl or auto) are optional. Emails that read right to left render as a mirror image of their templates.
cleanDocument from @email-love/core gives the document as it’s saved, or throws a DocumentError.

Design systems

A design system is { "tokens": { … }, "components": [ … ] }. Tokens hold the brand styles: Components each have:
  • key and name (required). The key is unique in the design system.
  • version, a whole number from 1. A changed component is a new version, and emails keep the version they use.
  • template (required). MJML that starts with <mj-wrapper> or <mj-section>, with {{field}}, {{{rich_text_field}}} and {{tokens.…}} placeholders, and blocks for lists and conditions.
  • fields (required). What a person can edit, in order.
  • category, zone, description, order and listed, which say how an editor files and describes it.
Fields have a key, type and label. The types are text, rich_text, link, image, select, color, number, boolean, list and code. Link fields refuse javascript: and other unsafe addresses. Code fields refuse <script>. See FORMAT.md for each type’s extra settings.

Your own components

In the editor, pass them as components. They’re added after the design system’s. A component that can’t be used is left out, and onError gets an error with code: 'COMPONENT_PROBLEMS' and a list of problems.
Use modules to choose which component keys people can add. With the engine, use addComponents(designSystem, components) from @email-love/core/components. It returns { designSystem, added, problems }. Each problem says which component and why: { component, message }. componentProblems(component) checks one component without adding it. A few things to know:
  • Give your keys a prefix. A key the design system already has is refused.
  • Pick a category. category files the component in the editor’s list: header, hero, content, ecommerce, conversion, structure or footer. Anything else goes under Other.
  • The MJML is checked later. The template’s MJML is checked when the email is drawn, not when the component is added.

Your own design system

Pass designSystem to the editor, or to renderEmail, instead of the built-in one. Run checkDesignSystem on it first to see any problems. Read FORMAT.md on GitHub