Skip to main content

SDK Methods

Complete reference for all methods available on the Pexelize editor instance. These methods are available across all framework wrappers and the vanilla JS SDK.

Design

MethodSignatureReturnDescription
loadDesign(design: DesignJson) => voidvoidReplace the current design with the provided JSON.
getDesign() => DesignJsonDesignJsonReturn the current design as JSON.
setBodyValues(values: Partial<BodyValues>) => voidvoidUpdate body-level values (background color, width, font family, etc.).
setMergeTags(tags: MergeTag[]) => voidvoidReplace the merge tags available in the editor.
setDesignTags(tags: Record<string, string>) => voidvoidReplace design tag values (rendered at export time).
setDisplayConditions(conditions: DisplayCondition[]) => voidvoidReplace the display conditions available for rows.

Export

MethodSignatureReturnDescription
exportHtml() => Promise<ExportHtmlData>Promise<ExportHtmlData>Export the design as responsive HTML. Returns { html, design }.
exportImage(options?: ExportImageOptions) => Promise<ExportImageData>Promise<ExportImageData>Export the design as a PNG/JPEG image. Returns { url, width, height }.
exportPdf(options?: ExportPdfOptions) => Promise<ExportPdfData>Promise<ExportPdfData>Export the design as a PDF. Returns { url, pages }.

Configuration

MethodSignatureReturnDescription
setLocale(locale: string) => voidvoidChange the editor UI language at runtime.
setTextDirection(dir: 'ltr' | 'rtl') => voidvoidChange text direction at runtime.
setTranslations(translations: Record<string, Record<string, string>>) => voidvoidUpdate or add translation strings.

Tools

MethodSignatureReturnDescription
setToolsConfig(config: ToolsConfig) => voidvoidShow/hide/lock specific content tools.
registerCustomTool(tool: CustomTool) => voidvoidRegister a custom tool at runtime.
unregisterCustomTool(toolId: string) => voidvoidRemove a previously registered custom tool.

Appearance

MethodSignatureReturnDescription
setTheme(theme: ThemeMode) => voidvoidSwitch between 'light' and 'dark' themes.
setAccentColor(color: AccentColor) => voidvoidChange the editor accent color.
setViewMode(mode: ViewMode) => voidvoidSwitch between 'desktop', 'tablet', and 'mobile' views.
setEditorMode(mode: EditorMode) => voidvoidSwitch between 'email' and 'web' editor modes.

Preview

MethodSignatureReturnDescription
showPreview() => voidvoidOpen the design preview modal.
hidePreview() => voidvoidClose the design preview modal.

Undo / Redo

MethodSignatureReturnDescription
undo() => voidvoidUndo the last action.
redo() => voidvoidRedo the last undone action.
canUndo() => booleanbooleanWhether there are actions to undo.
canRedo() => booleanbooleanWhether there are actions to redo.

Element Control

MethodSignatureReturnDescription
selectElement(elementId: string) => voidvoidProgrammatically select a content element by ID.
deselectElement() => voidvoidClear the current selection.
deleteElement(elementId: string) => voidvoidRemove a content element by ID.
duplicateElement(elementId: string) => voidvoidDuplicate a content element by ID.
moveElement(elementId: string, direction: 'up' | 'down') => voidvoidMove an element up or down within its column.

Validation

MethodSignatureReturnDescription
validate() => ValidationResultValidationResultRun validation checks and return errors/warnings.
getValidationErrors() => ValidationError[]ValidationError[]Get the current list of validation errors.

Lifecycle

MethodSignatureReturnDescription
isReady() => booleanbooleanWhether the editor is fully initialized.
destroy() => voidvoidDestroy the editor and clean up resources.
info

All Promise-returning methods reject with an EditorError if the operation fails. Wrap calls in try/catch for proper error handling.

warning

Calling methods before isReady() returns true (or before the ready event fires) will throw an error. Always wait for initialization to complete.