Email components

Write content in ordinary HTML and use email components only where a client needs table layout, button fallbacks, or required alt text.

Import Email, Section, Columns, Column, Button, Spacer, Divider, Image and Link from @samva/markup/email.

Write content in ordinary HTML: headings, paragraphs, lists, links, and tables. Components exist only where an email client needs something HTML cannot say on its own:

ComponentWhy it exists
EmailThe document shell: <head>, reset styles, dark-mode meta, and the preheader slot
SectionA full-width band, emitted as a table so Outlook keeps it
Columns, ColumnSide-by-side layout as table cells, stacking on mobile
ButtonA link styled as a button, with an Outlook fallback shape
ImageRequired alt, fixed dimensions, and a dark-mode source
Spacer, DividerVertical rhythm and rules that survive clients that strip margins
LinkA text link that opens outside the client

The brand components BrandLogo and BrandFooter come from samva:brand; see Brands.

  • A Button needs a string label and a height for the classic Outlook fallback. Without them the check warns with button-outlook-fallback.
  • Scripts, event handlers, and unsafe URL schemes are rejected. Strings are escaped text, never markup.
  • General flex and grid layouts are not converted to email tables. Use Columns for side-by-side content.
  • subject and preheader live on the email channel of the definition. <Email> does not take a preheader.

See Authoring in TSX for a complete template.

Related documentation