The root components every email template needs — Email, EmailHead, EmailPreview, and EmailBody.

Email Structure

The root components every email template needs — Email, EmailHead, EmailPreview, and EmailBody.


Anatomy of an email

Four components form the skeleton of every template:

Source code:

# File: docs/email-structure/structure.py

import dash_email as de

component = de.Email(
    lang="en",
    dir="ltr",
    children=[
        de.EmailHead(),
        de.EmailPreview("Your March summary is ready — open to see the highlights."),
        de.EmailBody(
            style={"backgroundColor": "#f0f4f8", "padding": "32px 0"},
            children=[
                de.EmailContainer([
                    de.EmailSection(
                        style={
                            "backgroundColor": "#ffffff",
                            "borderRadius": "8px",
                            "padding": "32px",
                        },
                        children=[
                            de.EmailHeading("Monthly Update", as_="h2"),
                            de.EmailText(
                                "The preview text above is hidden in the rendered "
                                "email body but shows next to the subject line in "
                                "the recipient's inbox."
                            ),
                        ],
                    )
                ])
            ],
        ),
    ],
)

Email

Email

NameTypeDescription
childrena list of or a singular dash component, string or number; optionalThe children of this component (EmailHead, EmailPreview, EmailBody, etc.).
idstring; optionalThe ID used to identify this component in Dash callbacks.
dira value equal to: 'ltr', 'rtl'; default 'ltr'Text direction of the email content.
langstring; default 'en'Language of the email content.

EmailHead

EmailHead

NameTypeDescription
childrena list of or a singular dash component, string or number; optionalThe children of this component (EmailFont, style elements, etc.).
idstring; optionalThe ID used to identify this component in Dash callbacks.

EmailPreview

EmailPreview

NameTypeDescription
childrena list of or a singular dash component, string or number; optionalThe preview text to display in email client inboxes.
idstring; optionalThe ID used to identify this component in Dash callbacks.

EmailBody

EmailBody

NameTypeDescription
childrena list of or a singular dash component, string or number; optionalThe children of this component (EmailContainer, EmailSection, etc.).
idstring; optionalThe ID used to identify this component in Dash callbacks.

Source: /components/email-structure

Note for AI agents: This is the static, prerendered view of an interactive Dash application served because we detected a non-JS user agent. Full prose docs: