Better Svelte Email provides Svelte components with sensible defaults for building email layouts. They all forward regular HTML attributes, merge inline styles, and take props tuned for email-friendly rendering.
Import from better-svelte-email. For @better-svelte-email/components, see Components (beta).
<script>
import {
Html,
Head,
Body,
Preview,
Container,
Section,
Row,
Column,
Heading,
Text,
Button,
Link,
Img,
Hr
} from 'better-svelte-email';
</script> Use Html, Head, and Body at the root, then mix layout and content components for the rest of your email.
lang? = 'en' — Language attribute.dir? = 'ltr' — Text direction.<html> attributes plus a default slot for nested components.<head> children.<body> attributes (class, style, etc.).preview: string (required) — Text shown in inbox previews, trimmed to 150 characters.<div> attributes.style with a max-width of 37.5em; accepts all <table> attributes.<table> attributes and a default slot.Column components, plus <table> attributes.<td> attributes, including align, width, and style.as? = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' — Element to render.m, mx, my, mt, mr, mb, ml.<h*> attributes.as? = string — Element type, defaults to <p>.<p> attributes.style with default font size/line height.href: string (required).target? = '_blank'.href? = '#'.target? = '_blank'.pX? = 0, pY? = 0 — Horizontal and vertical padding in pixels.<a> attributes.src: string, alt: string, width: string, height: string (all required).<img> attributes and merges custom styles.<hr> attributes and merges any styles you provide.