import { Renderer, toPlainText, type RenderOptions } from '@better-svelte-email/server'; const renderer = new Renderer(options?)
options?: tailwindConfig? — Partial Tailwind config. Use it to extend the default theme, using Tailwind CSS v3 syntax.customCSS? — Custom CSS string to inject into email rendering.await renderer.render(component, options?)
component — The compiled Svelte component to render (e.g. WelcomeEmail).options? — Object with the same shape as RenderOptions.Promise<string> containing email-safe HTML with Tailwind utilities inlined and necessary media queries injected into <head>.const html = await renderer.render(WelcomeEmail, {
props: { name: 'John' }
}); type RenderOptions = { props?: Record<string, unknown>; context?: Map<any, any>; idPrefix?: string; }
props? — Props forwarded to the Svelte component. Slot and event props are omitted automatically.context? — Custom context map that becomes available through Svelte’s getContext.idPrefix? — Prefix appended to generated element IDs to avoid collisions when embedding multiple renders.toPlainText(markup: string)
text field when sending emails via providers like Resend or SendGrid.