Integrate Unlayer Image Editor
Overview
Embed Unlayer's standalone Image Editor with plain JavaScript or React. Keep it distinct from the
image editor inside Unlayer's builders, which is configured through unlayer.init().
The standalone editor and all manual editing tools are free. The optional AI Assistant is paid.
Choose the Integration
| Need | Read |
|---|---|
| Plain JavaScript embed, loader, callbacks, or instance lifecycle | references/javascript.md |
React or Next.js with @unlayer/react-image-editor |
references/react.md |
| Tools, icons, dock, theme, localization, or AI Assistant | references/configuration.md |
| Configure the image editor opened from an image inside a builder | Use unlayer-config instead |
Core Workflow
- Accept an image URL or base64 data URL.
- Mount into a container at least 1024px wide and 700px high when possible.
- Handle
onSaveand upload the returnedblob; usedataUrlfor previews or inline display. - Handle
onLoadErrorseparately from script or lifecycle failures. - Check
hasChanges()before closing and calldestroy()when the editor is no longer needed.
Guardrails
- Use
https://cdn.unlayer.com/image-editor/embed.jsfor the JavaScript loader. - Use
@unlayer/react-image-editorfor React; do not substitutereact-email-editor. - Verify the package version with
npm view @unlayer/react-image-editor versionbefore pinning it. - Wait for the Promise returned by
createEditor()before calling instance methods. - Treat
projectIdas required for AI features. Manual tools do not require a paid feature. - Expect remote image URLs to require CORS access; use
onLoadErrorfor fetch, decode, or 404 failures. - Preserve the distinction between
dataUrlandblob: preview with the former, upload the latter.