> ## Documentation Index
> Fetch the complete documentation index at: https://help.emaillove.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Install the Email Love editor

> Install @email-love/editor and put the drag-and-drop email editor in a React app or a plain JavaScript page.

## Install

For the editor:

```sh theme={null}
npm install @email-love/editor react react-dom
```

For the engine on its own, with no editor:

```sh theme={null}
npm install @email-love/core
```

The editor needs React 18. It's your app's own copy, so install it next to the editor.

## React

Import the editor and its stylesheet. Give the element around it a height.

```jsx theme={null}
import EmailLoveEditor from '@email-love/editor'
import '@email-love/editor/style.css'

<div style={{ height: 720 }}>
  <EmailLoveEditor
    email={{ open: async () => savedDocument, save: async document => saveSomewhere(document) }}
    images={{ upload: async file => ({ url: await uploadSomewhere(file) }) }}
    onOpen={async session => console.log(await session.getHTML())}
  />
</div>
```

* `email.open` returns the email you saved before, or nothing for a new one.
* `email.save` keeps the email wherever your app stores it.
* `images.upload` stores a picture and returns its https address.
* `onOpen` gives you the session once the editor is ready.

## Plain JavaScript

If your app doesn't use React, use `mountEmailLoveEditor`. It takes the element to put the editor in and the same options.

```js theme={null}
import { mountEmailLoveEditor } from '@email-love/editor'

const editor = mountEmailLoveEditor(document.getElementById('editor'), { email, images })
const session = await editor.ready
const html = await session.getHTML()
```

The element still needs a height.

## Vite

The renderer runs in a worker file that ships beside the editor's `index.js`. Bundlers copy it for you. With Vite, also leave the package out of its development pre-bundling, or the worker isn't found while developing:

```js theme={null}
// vite.config.js
export default { plugins: [react()], optimizeDeps: { exclude: ['@email-love/editor'] } }
```

## Try it without an app

Clone the repository and run the demo:

```sh theme={null}
git clone https://github.com/email-love/email-love-sdk
cd email-love-sdk
npm install
npm run demo
```

The editor opens at `http://localhost:5341/packages/editor/demo/`.

The same demo is also online: [try the live demo](https://email-love.github.io/email-love-sdk/).

## Next steps

* [Options and session](https://help.emaillove.com/builder/sdk/options.md)
* [Design systems and your own components](https://help.emaillove.com/builder/sdk/design-systems.md)
* [FAQ](https://help.emaillove.com/builder/sdk/faq.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.