API Reference

Complete props reference for the ImageEditor and ImageEditorModal components. For the config object, see Configuration.

ImageEditor

The main editor component. Renders inline at the given dimensions.

PropTypeDefaultDescription
srcstring | File | Blob | HTMLImageElement | HTMLCanvasElementRequired. Image source.
onSave(blob: Blob) => voidCalled when the user exports the image.
onClose(reason?: CloseReason, hasUnsavedChanges?: boolean) => voidCalled when the editor closes.
onReady(handle: EditorHandle) => voidFires once when the engine is ready, exposing an imperative handle.
widthstring | number"100%"Editor width.
heightstring | number"100vh"Editor height.
configImageEditorConfig{}Editor configuration.
slotsEditorSlotsCustom UI slots.
eventsEditorEventCallbacksEvent callbacks.
validationImageValidationOptionsFile validation rules.
keepZoomOnSourceChangebooleanfalsePreserve zoom/pan when src changes.

CloseReason is one of "save", "close-button", "back-button", or "escape".

ImageEditorModal

Wraps ImageEditor in a Radix Dialog for modal usage. Accepts all ImageEditor props, plus:

PropTypeDefaultDescription
openbooleanRequired. Control modal visibility.
onOpenChange(open: boolean) => voidCalled when visibility changes.
classNamestringClass for the dialog content wrapper.
overlayClassNamestringClass for the overlay.

EditorSlots

Inject custom UI into the editor shell. See Inject Custom UI.

SlotTypeDescription
topbarRightReactNodeRight side of the top bar (before export).
sidebarBottomReactNodeBottom of the tool sidebar (above Apps).
contextualBarExtraReactNodeExtra content in the contextual bar.

EditorEventCallbacks

React to editor lifecycle events. See React to Editor Events.

CallbackTypeDescription
onToolChange(toolId: string | null) => voidFires when the active tool changes.
onBeforeSave(blob: Blob) => Promise<Blob | undefined> | Blob | undefinedTransform the export blob before save.

ImageValidationOptions

Reject or warn on unsuitable source files.

OptionTypeDefaultDescription
acceptedFormatsstring[]common image typesAccepted MIME types.
maxFileSizenumber50 MBReject files larger than this (bytes).
warnFileSizenumber20 MBWarn above this size (bytes).
maxDimensionnumber16000Reject images wider/taller than this (px).
warnDimensionnumber8000Warn above this dimension (px).

Next steps