Skip to content

Editor options

The Editor is created with a single options object:

js
const editor = new Editor(options)

Options

OptionTypeDefaultDescription
targetstring | HTMLElementrequiredContainer element
widthnumber1080Initial page width
heightnumber1080Initial page height
namestring'Untitled design'File name
theme'light' | 'dark' | 'system' | string'light'UI color scheme; 'system' follows the OS preference, a custom name resolves via themes
templatesEditorTemplate[]Extra templates shown in the Templates panel (appended after the built-ins)
fontsstring[]Extra font family names offered in the font pickers
googleFontsstring[]Extra Google Fonts css2 family specs, e.g. 'Familia:wght@400;700'
palettestring[] | { label, colors }[]built-inReplaces the default color swatches for this editor
gradients{ from, to, angle? }[]built-inReplaces the default gradient presets for this editor
chartColorsstring[]built-inReplaces the default chart series colors (applies to every editor on the page)
initialDocDesignDocumentDesign document loaded during initialization
imageSourcesImageSource[]Image search providers shown in the Uploads panel
historyHistoryLikebuilt-inInjects a custom history strategy implementing the snapshot interface
historyLimitnumber100Maximum number of undo snapshots kept in memory
themesRecord<string, Record<string, string>>Named custom themes (CSS variable sets) usable via theme and setTheme()
cssVarsRecord<string, string>CSS custom properties applied to the editor container on top of the theme
uiboolean | objectall enabledfalse for headless; per-module false to disable or a constructor to replace (topbar, sidepanel, toolbar, contextMenu, pagesBar)

Examples

Restore a saved design

js
const doc = JSON.parse(localStorage.getItem('design'))

const editor = new Editor({
  target: '#app',
  initialDoc: doc
})

Brand colors and fonts

js
new Editor({
  target: '#app',
  palette: [{ label: 'Brand', colors: ['#1e293b', '#FACC15', '#f1f5f9'] }],
  gradients: [{ from: '#FACC15', to: '#ffffff', angle: 135 }],
  fonts: ['Brand Sans'],
  googleFonts: ['Poppins:wght@400;600;800']
})

Custom themes and CSS variables

js
const editor = new Editor({
  target: '#app',
  themes: {
    ocean: { '--ez-accent': '#0ea5e9', '--ez-bg': '#0f172a' }
  },
  cssVars: { '--ez-radius': '12px' }
})

editor.setTheme('ocean')

Disable or replace a UI module

js
new Editor({ target: '#app', ui: { contextMenu: false } }) // disable one module
new Editor({ target: '#app', ui: { toolbar: MyToolbar } }) // replace a module

See UI modules and Headless mode for details.

Global vs per-editor options

A few option values normalize into page-global state rather than per-editor state:

  • chartColors normalizes into chart data and therefore applies globally to all editors on the page.
  • Element type/manifest registration and chart type registration are likewise page-global.
  • Asset registries (templates, fonts, shapes, icons, palette) are per editor instance.

The auto-init attributes

With the UMD bundle, any element carrying data-ezr-editor becomes an editor on page load:

AttributeDescription
data-ezr-editorMarks the element as an editor container
data-ezr-widthInitial page width
data-ezr-heightInitial page height
data-ezr-nameFile name

Size the container with CSS — the editor UI fills it.

Released under the MIT License.