The recommended way to start is with the standalone EmailEditor component. It
gives you a working editor with the default bubble menus, slash commands,
theming, and export helpers already wired up:
import { EmailEditor } from '@react-email/editor';const content = ` <h1>Welcome</h1> <p> This is the simplest way to use the editor. Try selecting text to see the bubble menu, or type "/" for slash commands. </p>`;export function MyEditor() { return <EmailEditor content={content} />;}
If you need more control, drop down to Tiptap’s EditorProvider and compose the
editor yourself. This is the lower-level path: you choose the extensions, add
UI overlays manually, and import any CSS you need.Common building blocks on this path are StarterKit,
BubbleMenu,
SlashCommand,
EmailTheming,
composeReactEmail, and the
useEditor hook.The simplest manual setup uses StarterKit with EditorProvider and no UI
overlays:
import { StarterKit } from '@react-email/editor/extensions';import { EditorProvider } from '@tiptap/react';const extensions = [StarterKit];const content = ` <h1>Welcome</h1> <p>Start typing or edit this text.</p>`;export function MyEditor() { return <EditorProvider extensions={extensions} content={content} />;}
To add a floating formatting toolbar that appears when you select text, add BubbleMenu
as a child of EditorProvider:
import { StarterKit } from '@react-email/editor/extensions';import { BubbleMenu } from '@react-email/editor/ui';import { EditorProvider } from '@tiptap/react';import '@react-email/editor/themes/default.css';const extensions = [StarterKit];const content = ` <p> Select this text to see the bubble menu. Try <strong>bold</strong>, <em>italic</em>, and other formatting options. </p>`;export function MyEditor() { return ( <EditorProvider extensions={extensions} content={content}> <BubbleMenu /> </EditorProvider> );}
Select text in the editor to see the formatting toolbar with bold, italic,
underline, alignment, and more.