Skip to main content
@sendflit/email-components provides React components for building email templates. They use table-based layout and inline styles, so they render correctly in Outlook and Gmail. The package has no rendering dependency: render() wraps React’s own renderToStaticMarkup.

Install

Requires React 18 or later and Node.js 18 or later.

Build a template

Send the rendered HTML

Pass the output of render() to the Node.js SDK:

Components

Every component accepts a style prop (a React.CSSProperties object) to override its defaults.

render()

render(element) returns a complete HTML document string starting with <!doctype html>.
render() runs on the server only, because it imports react-dom/server. Call it from a route handler, a server action, or other server code. Don’t call it from a client component.

Why the components look like this

Email clients render HTML much more narrowly than browsers do. Outlook (desktop) ignores flexbox and grid, Gmail strips some <style> blocks, and tables with zeroed padding are the one layout every client handles consistently. That’s why every component is built from tables with inline styles.