Skip to main content

How to Embed the Mockup Editor on Your Website

Simple and easy way to embed our editor(s) on your website so you can let your users experience power of Dynamic Mockups.

Written by Dynamic Mockups Support
Updated over 2 months ago

Overview

The Embeddable Mockup Editor is a product customizer that integrates directly into your website or application, allowing your customers to create and customize mockups without leaving your platform.

Available in two versions: Classic Editor and MockAnything AI Editor.

It provides a complete mockup creation experience through a simple iframe embed.

Live Demo: Try it here

Perfect for:

  • E-commerce sites offering product customization

  • Print-on-demand platforms

  • Low-code/no-code platform builders

  • SaaS applications adding mockup features

  • Developers building product configurators

Classic Mockup Editor

The Classic Editor provides traditional mockup editing with full design control and product customization options.

Features:

  • Browse 1,000+ professional mockup templates

  • Upload custom designs

  • Apply color overlays and variations

  • Adjust design placement and sizing

  • Transform controls (rotate, scale, position)

  • Export individual mockups or full collections

  • Artwork library management

  • Print file generation (optional)

Best for:

  • Product customization for e-commerce

  • Standard mockup generation workflows

  • Template-based design applications

MockAnything AI Editor

The MockAnything AI Editor uses artificial intelligence to transform any image into a professional lifestyle mockup with advanced scene customization.

Features:

  • AI Image Generation - Create mockups from text prompts using SeeDream 4.0

  • Scene Transformation - Change backgrounds, environments, and settings

  • Smart Product Detection - Automatically identify products and unlock real manufacturer colors

  • Advanced AI Tools:

    • Ethnicity modification

    • Pose adjustments

    • Camera angle changes

    • Environment replacement

    • Scene enhancement

  • Traditional Mockup Tools - Artwork placement, color changes, exports (free, no credits)

  • AI Photoshoot Generation - Create multiple variations automatically

AI Credit Usage:

  • Prompt Image Generation: 3 credits per generation (*SeeDream model, different models available)

  • Editor AI Tools (scene changes, modifications): 5 credits per edit

  • AI Photoshoot Generation: 3 credits per variation

  • Mockup Tools (artwork, colors, exports): Free (no credits)

Best for:

  • Unique lifestyle mockups

  • Brand-specific scenes and environments

  • AI-powered product visualization

  • Creative mockup customization beyond templates

How to Embed the Editor

Method 1: Basic iframe Embed (No Code Required)

The simplest way to embed the editor, perfect for no-code platforms like Bubble.io.

Step 1: Generate Your Website Key

  1. Log in to Dynamic Mockups

  2. Click "Generate Website Key"

  3. Copy the provided embed code

Step 2: Add iframe to Your Website

<iframe
id="dm-iframe"
src="https://embed.dynamicmockups.com"
style="width: 100%; height: 90vh"
></iframe>

Step 3: Initialize with CDN Script

Add the SDK script before your closing </body> tag:

<script src="https://cdn.jsdelivr.net/npm/@dynamic-mockups/mockup-editor-sdk@latest/dist/index.js"></script>

<script>
document.addEventListener("DOMContentLoaded", function () {
DynamicMockups.initDynamicMockupsIframe({
iframeId: "dm-iframe",
data: {
"x-website-key": "YOUR_WEBSITE_KEY_HERE"
},
mode: "download"
});
});
</script>

Method 2: JavaScript Framework Integration (React, Vue, etc.)

For dynamic applications with JavaScript frameworks.

Step 1: Install via npm

npm install @dynamic-mockups/mockup-editor-sdk@latest

or

yarn add @dynamic-mockups/mockup-editor-sdk@latest

Step 2: Import and Initialize

import { initDynamicMockupsIframe } from "@dynamic-mockups/mockup-editor-sdk";

// Add iframe to your component
<iframe
id="dm-iframe"
src="https://embed.dynamicmockups.com"
style={{ width: '100%', height: '90vh' }}
></iframe>

// Initialize the editor
initDynamicMockupsIframe({
iframeId: "dm-iframe",
data: {
"x-website-key": "YOUR_WEBSITE_KEY_HERE"
},
mode: "download"
});

Method 3: API-Initialized Editor (Dynamic Integration)

For advanced integrations requiring full control and dynamic initialization.

Endpoint: POST /api/v1/mock-anything/embed/initialize

Request Example:

{
"prompt": "A guy wearing a Gildan 5000 t-shirt in Belgrade",
"artwork_url": "https://example.com/my-logo.png"
}

Response:

{
"data": {
"iframe_editor": "<iframe ...>",
"init_function": "window.initDynamicMockupsIframe(...)",
"event_listener_name": "dm_174829182"
}
}

Benefits:

  • Dynamic prompt-based generation

  • Start from uploaded images

  • Pass artwork URLs programmatically

  • Deep integration with React/Vue/Angular

  • Full event system for exports and updates

React Example:

import { useState, useEffect } from "react";
import { initDynamicMockupsIframe } from "@dynamic-mockups/mockup-editor-sdk";

// Expose function globally for iframe communication
window.initDynamicMockupsIframe = initDynamicMockupsIframe;

export default function DynamicEditor() {
const [iframeData, setIframeData] = useState(null);

const launchEditor = async () => {
const response = await fetch(
"https://app.dynamicmockups.com/api/v1/mock-anything/embed/initialize",
{
method: "POST",
headers: {
"Content-Type": "application/json",
"x-api-key": "YOUR_API_KEY"
},
body: JSON.stringify({
prompt: "Modern office desk scene",
artwork_url: "https://example.com/logo.png"
})
}
);

const result = await response.json();
setIframeData(result.data);

// Run initialization script
setTimeout(() => {
eval(result.data.init_function);
}, 100);
};

// Listen for editor events
useEffect(() => {
const handleMessage = (event) => {
if (event.data?.eventListenerName === iframeData?.event_listener_name) {
console.log("Editor event:", event.data.data);
}
};

window.addEventListener("message", handleMessage);
return () => window.removeEventListener("message", handleMessage);
}, [iframeData]);

return (
<div>
<button onClick={launchEditor}>Launch Editor</button>
<div dangerouslySetInnerHTML={{ __html: iframeData?.iframe_editor }} />
</div>
);
}

Editor Configuration Options

Customize the editor behavior using the data parameter in initDynamicMockupsIframe().

Core Configuration

Parameter

Type

Default

Description

iframeId

string

"dm-iframe"

ID of your iframe element

data

object

Required

Editor configuration options

mode

string

"download"

"download" or "custom" for callback mode

callback

function

Optional

Callback function when mode is "custom"

Data Configuration Options

Field

Type

Default

Description

x-website-key

string

Required

Your website key from dashboard

editorType

string

"classic"

"classic" or "mockanything"

themeAppearance

string

"light"

"light" or "dark"

showColorPicker

boolean

true

Display color picker tool

showColorPresets

boolean

false

Show saved color presets

showCollectionsWidget

boolean

true

Display collections panel

showSmartObjectArea

boolean

false

Show design placement boundaries

showTransformControls

boolean

true

Display size/rotation controls

showArtworkLibrary

boolean

false

Show artwork library panel

showUploadYourArtwork

boolean

true

Display artwork upload button

showArtworkEditor

boolean

true

Show artwork editing tools

oneColorPerSmartObject

boolean

false

Limit to one color per design area

enableColorOptions

boolean

true

Enable color customization

enableCreatePrintFiles

boolean

false

Export production print files

enableCollectionExport

boolean

false

Export all mockups in collection

exportMockupsButtonText

string

"Export Mockups"

Custom button text

designUrl

string

Optional

Pre-load design (disables upload)

customFields

object

Optional

Pass custom data (returned in callback)

Export Options

Field

Type

Default

Description

mockupExportOptions.image_format

string

"webp"

"webp", "jpg", or "png"

mockupExportOptions.image_size

number

1080

Max dimension in pixels

mockupExportOptions.mode

string

"download"

"download" or "view"

Color Presets

colorPresets: [
{
name: "Brand Colors",
autoApplyColors: true,
colors: [
{ hex: "#FF5733", name: "Brand Red" },
{ hex: "#33FF57", name: "Brand Green" }
]
}
]

Artwork Library

artworkLibrary: [
{
name: "Logo Primary",
url: "https://example.com/logo.png",
thumbnail: "https://example.com/logo-thumb.png",
id: "logo-1"
}
]

Note: Requires showArtworkLibrary: true

Configuration Examples

Basic Setup (Classic Editor)

DynamicMockups.initDynamicMockupsIframe({
iframeId: "dm-iframe",
data: {
"x-website-key": "YOUR_KEY_HERE"
},
mode: "download"
});

MockAnything AI Editor

DynamicMockups.initDynamicMockupsIframe({
iframeId: "dm-iframe",
data: {
"x-website-key": "YOUR_KEY_HERE",
editorType: "mockanything"
}
});

Customized Editor with Presets

DynamicMockups.initDynamicMockupsIframe({
iframeId: "dm-iframe",
data: {
"x-website-key": "YOUR_KEY_HERE",
themeAppearance: "dark",
showColorPresets: true,
enableCreatePrintFiles: true,
colorPresets: [
{
name: "Brand Colors",
autoApplyColors: true,
colors: [
{ hex: "#FF5733", name: "Primary" },
{ hex: "#33C1FF", name: "Secondary" }
]
}
],
mockupExportOptions: {
image_format: "png",
image_size: 2000
}
},
mode: "download"
});

Custom Callback Mode

DynamicMockups.initDynamicMockupsIframe({
iframeId: "dm-iframe",
data: {
"x-website-key": "YOUR_KEY_HERE",
customFields: {
userId: "12345",
productId: "ABC-001",
category: "T-Shirts"
}
},
mode: "custom",
callback: (callbackData) => {
console.log("Export Label:", callbackData.mockupsExport[0].export_label);
console.log("Image URL:", callbackData.mockupsExport[0].export_path);
console.log("Custom Fields:", callbackData.customFields);

// Save to your database, display to user, etc.
}
});

Opening Specific Mockups

By default, the editor displays the entire mockup catalog. To open a specific mockup directly:

Method 1: Modify iframe src

<iframe
id="dm-iframe"
src="https://embed.dynamicmockups.com/mockup/43981bf4-3f1a-46cd-985e-3d9bb40cef36/"
style="width: 100%; height: 90vh"
></iframe>

Method 2: Get mockup UUID

Retrieve mockup UUIDs from:

  • Web application URL when viewing mockups

  • Dynamic Mockups dashboard

Bubble.io Integration

Integrate the mockup editor into Bubble.io without any code.

Step 1: Add HTML Element

In your Bubble.io editor, drag an HTML element to where you want the mockup editor to appear.

Step 2: Add Embed Code

  1. Copy the embeddable shortcode provided

  2. Paste it into the HTML element in Bubble

  3. Important: Check "Display as an iFrame" option

Step 3: Preview and Test

Preview your Bubble app: the embedded editor should appear and function fully.

Event System

Listen for events from the editor using the event listener system.

Available Events

  • editor_ready - Editor loaded and ready

  • export_completed - Mockup export finished

  • photoshoot_completed - AI photoshoot generated

  • artwork_updated - Design changed

  • variant_changed - Color/option changed

Event Listening

window.addEventListener("message", (event) => {
if (event.data.eventListenerName === "your_event_listener_name") {
const eventData = event.data.data;

switch(eventData.type) {
case "export_completed":
console.log("Mockup URL:", eventData.export_path);
break;
case "editor_ready":
console.log("Editor is ready!");
break;
}
}
});

Use Cases

E-commerce Product Customization

Allow customers to personalize products before purchase:

  • Upload designs directly on product pages

  • Preview products with their artwork

  • Generate mockups for cart/checkout

  • Export production files on order

Example: Print-on-demand store letting customers design t-shirts

SaaS Product Features

Add mockup generation to your platform:

  • Offer product visualization tools

  • Provide design previews for users

  • Generate marketing materials

  • Create portfolio mockups

Example: Design platform adding product mockup export

Agency Client Portals

Give clients mockup creation capabilities:

  • Self-service mockup generation

  • Brand-consistent templates

  • Controlled color palettes

  • White-label experience

Example: Marketing agency portal for client asset creation

Low-Code/No-Code Applications

Extend Bubble, Webflow, or other platforms:

  • No coding required

  • Drag-and-drop integration

  • Visual configuration

  • Instant functionality

Example: Bubble marketplace app with mockup features

Credit Usage

  • Editor usage consumes credits from your account

  • AI features (MockAnything) use additional credits

  • Standard mockup tools (uploads, colors, exports) included

  • Print file generation: 2 credits per file

Best Practices

Generate website key first - Required for authentication, generate free from dashboard

Start with Classic Editor - Test basic functionality before adding AI features

Use custom callbacks - Capture export data for your database or workflows

Configure thoughtfully - Only enable features your users need

Test in preview mode - Verify editor behavior before deploying

Implement event listeners - Track user actions and exports

Optimize iframe size - Ensure adequate space for editor interface (minimum 600px height)

Pre-configure colors - Use color presets for brand consistency

Consider mobile responsiveness - Test editor on mobile devices

Monitor credit usage - Track consumption to avoid interruptions

Troubleshooting

Editor not loading?

  • Verify website key is correct

  • Check iframe dimensions (minimum 600px height recommended)

  • Ensure JavaScript is enabled

  • Confirm SDK script is loaded before initialization

Events not firing?

  • Verify event listener name matches API response

  • Check browser console for errors

  • Ensure postMessage listeners are set up correctly

Customization options not working?

  • Confirm configuration fields are spelled correctly

  • Check data parameter is properly formatted as object

Credits depleted?

  • Check remaining credits in dashboard

  • Upgrade plan or purchase top-up

  • Monitor usage to prevent interruptions

Integration issues with Bubble.io?

  • Ensure "Display as an iFrame" is checked

  • Verify embed code is copied completely

  • Check HTML element dimensions

Technical Requirements

Browser Support:

  • Chrome 90+

  • Firefox 88+

  • Safari 14+

  • Edge 90+

JavaScript: Required for interactive functionality

Minimum iframe dimensions: 600px height recommended

Internet connection: Required for real-time editing and exports

Developer Resources

Documentation

Live Demo

Support

Ready to embed? Generate your website key and start integrating the mockup editor into your platform today.

Need custom integration? Contact our team for Enterprise solutions with white-label options and dedicated support.

Questions? Join our Slack community or email [email protected] for help.

Did this answer your question?