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:
Email— the root wrapper (equivalent to React Email'sHtml)EmailHead— metadata such as the document title and font importsEmailPreview— the snippet shown next to the subject line in the inbox, hidden in the bodyEmailBody— the visible content wrapper
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."
),
],
)
])
],
),
],
)
| Name | Type | Description |
|---|---|---|
| children | a list of or a singular dash component, string or number; optional | The children of this component (EmailHead, EmailPreview, EmailBody, etc.). |
| id | string; optional | The ID used to identify this component in Dash callbacks. |
| dir | a value equal to: 'ltr', 'rtl'; default 'ltr' | Text direction of the email content. |
| lang | string; default 'en' | Language of the email content. |
EmailHead
EmailHead
| Name | Type | Description |
|---|---|---|
| children | a list of or a singular dash component, string or number; optional | The children of this component (EmailFont, style elements, etc.). |
| id | string; optional | The ID used to identify this component in Dash callbacks. |
EmailPreview
EmailPreview
| Name | Type | Description |
|---|---|---|
| children | a list of or a singular dash component, string or number; optional | The preview text to display in email client inboxes. |
| id | string; optional | The ID used to identify this component in Dash callbacks. |
EmailBody
EmailBody
| Name | Type | Description |
|---|---|---|
| children | a list of or a singular dash component, string or number; optional | The children of this component (EmailContainer, EmailSection, etc.). |
| id | string; optional | The 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:
- /components/email-structure/llms.txt — LLM-friendly documentation
- /sitemap.xml
- /robots.txt