Embed the React Email editor in your app
The React Email editor is an open-source visual editor that lets your users author email templates inside your own product. It ships with bubble menus, slash commands, an Inspector sidebar, and extensible nodes. It also exports email-ready HTML you can hand straight to Resend.
This guide walks through embedding the editor in a React app, styling it to match your brand, customizing the Inspector Sidebar, and adding your own custom node.
Prerequisites
Section titled “Prerequisites”- A React 18+ application (for example, Vite, Next.js, or Remix)
- A bundler with package exports support (the defaults for the frameworks above)
Install the editor
Install
@react-email/editorand import the bundled theme stylesheet once at your app root.npm npm install @react-email/editoryarn yarn add @react-email/editorpnpm pnpm add @react-email/editorbun bun add @react-email/editorapp/layout.tsx import '@react-email/editor/themes/default.css';The bundled theme covers the bubble menus, slash commands, and Inspector. If you only use a subset, you can import individual stylesheets instead.
Mount the base editor
The fastest path is the standalone
EmailEditorcomponent. It comes with the default extensions, bubble menus, slash commands, and theming wired up.app/components/Editor.tsx 'use client'; import { EmailEditor } from '@react-email/editor'; const initialContent = ` <h1>Welcome</h1> <p>Type "/" for a command, or select text to format it.</p> `; export function Editor() { return <EmailEditor content={initialContent} />; }contentaccepts an HTML string or a TipTap JSON document. See theEmailEditorAPI reference for the full prop list.Style the editor
The editor exposes two layers of styling:
- Editor chrome (bubble menus, slash command palette, Inspector controls) — driven by CSS custom properties (
--re-*) anddata-re-*attribute selectors. - Editor content (what the user is typing) — uses TipTap's
.tiptaproot class. Note that styling here only affects the in-editor preview; the exported HTML is styled by the theming system.
Override the CSS variables on a wrapper class to apply your brand:
app/styles/editor.css .brand-editor { --re-bg: #fafaf9; --re-border: #d6d3d1; --re-text: #1c1917; --re-text-muted: #78716c; --re-hover: rgba(28, 25, 23, 0.04); --re-active: rgba(28, 25, 23, 0.08); --re-radius: 0.5rem; --re-radius-sm: 0.25rem; } /* Target a specific bubble menu button */ [data-re-bubble-menu-item][data-active] { background: #2563eb; color: #fff; } /* Style the user's content area inside the editor */ .tiptap h1 { font-size: 1.75rem; letter-spacing: -0.025em; }TSX <div className="brand-editor"> <EmailEditor content={initialContent} /> </div>The default theme also responds to
prefers-color-scheme: darkand to a.darkclass on any ancestor — so it works with libraries likenext-themesout of the box. See the Styling reference for the complete list of variables,data-re-*selectors, and content classes.- Editor chrome (bubble menus, slash command palette, Inspector controls) — driven by CSS custom properties (
Add the Inspector Sidebar
The Inspector is a contextual sidebar that swaps panels based on the user's current selection — document defaults when nothing is focused, node properties when a block is selected, text formatting when text is selected.
Pass
Inspector.Rootas a child ofEmailEditorso it shares the editor's context:app/components/Editor.tsx 'use client'; import { EmailEditor } from '@react-email/editor'; import { Inspector } from '@react-email/editor/ui'; export function Editor() { return ( <div className="flex" style={{ height: '600px' }}> <EmailEditor content="<h1>Hello</h1><p>Click any element to inspect it.</p>" className="flex-1 min-w-0 overflow-y-auto p-4" > <Inspector.Root className="w-72 shrink-0 border-l p-4 overflow-y-auto"> <Inspector.Breadcrumb /> <Inspector.Document /> <Inspector.Node /> <Inspector.Text /> </Inspector.Root> </EmailEditor> </div> ); }See the Inspector reference for every render-prop helper, the full list of reusable section components (
Inspector.Size,Inspector.Padding,Inspector.Border,Inspector.Typography,Inspector.Background,Inspector.Link), and runnable examples.Add a custom extension
Custom blocks use
EmailNode, which extends TipTap'sNodewith therenderToReactEmailmethod so the same node renders correctly inside the editor and in the exported email.Send the result with Resend
If you use the standalone
EmailEditorcomponent, you can access the email HTML and plain text through ref methods. In your handler, send the HTML to Resend using the Send Email or Send Batch Emails API.TSX import { EmailEditor, type EmailEditorRef } from '@react-email/editor'; import { useRef, useState } from 'react'; export function MyEditor() { const ref = useRef<EmailEditorRef>(null); const handleExport = async () => { if (!ref.current) return; const html = await ref.current.getEmailHTML(); // Send email using Resend using a server-side API endpoint/action const response = await fetch('/api/send-email', { method: 'POST', body: JSON.stringify({ html }), }); }; return ( <div> <EmailEditor ref={ref} content="<p>Edit me</p>" /> <button onClick={handleExport}>Export HTML</button> </div> ); }The ref exposes three export methods:
Method Returns Description getEmailHTML()Promise<string>Email-ready HTML getEmailText()Promise<string>Plain text version getEmail()Promise<{ html, text }>Both in a single call All three use composeReactEmail under the hood.
Next steps
Section titled “Next steps”React Email editor reference
The complete API surface — extensions, UI components, theming, and image upload.
Editor styling reference
Every CSS variable and data-re-* selector you can target.
Custom extensions
Wrap existing TipTap extensions or build new email-safe nodes and marks.
Template emails with React Email
Author templates as .tsx files and upload them to Resend with the CLI.