MCPcopy
hub / github.com/unlayer/react-email-editor

github.com/unlayer/react-email-editor @main sqlite

repository ↗ · DeepWiki ↗
24 symbols 51 edges 12 files 0 documented · 0%
README

React Email Editor

Official React component for embedding Unlayer’s drag-and-drop email editor in your app.

npm version stars license downloads


Introduction

Add a production-ready, drag-and-drop email builder to your React app with a single component. react-email-editor lets developers embed Unlayer, load and save designs, listen to editor events, customize configuration, and export responsive HTML.

Use it when you need email template creation inside your app without building and maintaining a full visual editor from scratch.

Video Overview
React Email Editor
Watch video overview: https://youtu.be/qp9t74G4VyM

Live Demo

Check out the live demo here: https://react-email-editor-demo.netlify.app/ (Source Code)

Installation

The easiest way to use React Email Editor is to install it from NPM and include it in your own React build process.

npm install react-email-editor --save

Usage

Require the EmailEditor component and render it with JSX:

import React, { useRef } from 'react';
import { render } from 'react-dom';

import EmailEditor, { EditorRef, EmailEditorProps } from 'react-email-editor';

const App = (props) => {
  const emailEditorRef = useRef<EditorRef>(null);

  const exportHtml = () => {
    const unlayer = emailEditorRef.current?.editor;

    unlayer?.exportHtml((data) => {
      const { design, html } = data;
      console.log('exportHtml', html);
    });
  };

  const onReady: EmailEditorProps['onReady'] = (unlayer) => {
    // editor is ready
    // you can load your template here;
    // the design json can be obtained by calling
    // unlayer.loadDesign(callback) or unlayer.exportHtml(callback)

    // const templateJson = { DESIGN JSON GOES HERE };
    // unlayer.loadDesign(templateJson);
  };

  return (






        <button onClick={exportHtml}>Export HTML</button>




      <EmailEditor ref={emailEditorRef} onReady={onReady} />



  );
};

render(<App />, document.getElementById('app'));

See the example source for a reference implementation.

Methods

All unlayer methods are available in the editor instance (emailEditorRef.current.editor). See the Unlayer Docs for more information, or log the object in the console to explore it. Here are the most used ones:

method params description
loadDesign Object data Takes the design JSON and loads it in the editor
saveDesign Function callback Returns the design JSON in a callback function
exportHtml Function callback Returns the design HTML and JSON in a callback function

Properties

  • editorId {String} HTML div id of the container where the editor will be embedded (optional)
  • minHeight {String} minimum height to initialize the editor with (default 500px)
  • onLoad {Function} called when the editor instance is created
  • onReady {Function} called when the editor has finished loading
  • options {Object} options passed to the Unlayer editor instance (default {})
  • See the Unlayer Docs for all available options.
  • style {Object} style object for the editor container (default {})

Support

The email editor output is tested using the most popular email clients.

Gmail logo Apple Mail Outlook logo Yahoo! Mail logo
Gmail ✔ Apple Mail ✔ Outlook ✔ Yahoo! Mail ✔

AI Assistant

Add AI-powered content creation to your embedded email editor.

Unlayer’s AI Assistant helps users generate, rewrite, translate, and improve email content directly inside the editor. Developers can enable AI features through the editor configuration, giving users a faster way to create polished emails without leaving your app.

Custom Tools

Custom tools can help you add your own content blocks to the editor. Every application is different and needs different tools to reach it's full potential. Learn More

Custom Tools

Localization

You can submit new language translations by creating a PR on this GitHub repo: https://github.com/unlayer/translations. Translations managed by PhraseApp

License

Copyright (c) 2026 Unlayer. MIT Licensed.

Extension points exported contracts — how you extend this code

EditorRef (Interface)
(no doc)
src/types.ts
EmailEditorProps (Interface)
(no doc)
src/types.ts
Window (Interface)
(no doc)
src/types.ts

Core symbols most depended-on inside this repo

runCallbacks
called by 2
src/loadScript.ts
isScriptInjected
called by 1
src/loadScript.ts
addCallback
called by 1
src/loadScript.ts
loadScript
called by 1
src/loadScript.ts
onLoad
called by 1
demo/src/example/index.tsx
onReady
called by 1
demo/src/example/index.tsx
rollup
called by 0
tsdx.config.js
EmailEditorInner
called by 0
src/EmailEditor.tsx

Shape

Function 19
Interface 3
Method 2

Languages

TypeScript100%

Modules by API surface

demo/src/example/index.tsx7 symbols
src/types.ts5 symbols
src/loadScript.ts4 symbols
demo/src/dashboard/DesignEdit.tsx3 symbols
tsdx.config.js1 symbols
src/EmailEditor.tsx1 symbols
demo/src/dashboard/index.tsx1 symbols
demo/src/dashboard/DesignList.tsx1 symbols
demo/index.tsx1 symbols

Dependencies from manifests, versioned

@rollup/plugin-replace5.0.2 · 1×
@testing-library/react13.4.0 · 1×
@types/react18.0.27 · 1×
@types/react-dom18.0.10 · 1×
@unlayer/typeslatest · 1×
husky8.0.3 · 1×
parcel1.12.3 · 1×
react18.2.0 · 1×
react-app-polyfill1.0.0 · 1×
react-dom18.2.0 · 1×
react-is18.2.0 · 1×
react-router-dom6.8.0 · 1×

For agents

$ claude mcp add react-email-editor \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact