Skip to main content
Put the editor in your own layout, or make it the whole page.

Two Layouts

For a dialog over the page, use the modal instead.

In Your Box

The editor fills its parent’s box, so give the parent a height, and at least 320 px of width: it lays itself out by that box, not the window, and nothing overflows from 320 px up.
The editor inline in a page: a story form on the left and the editor in a bordered box on the right, a lake photo in its crop view, Save at its top right and no Close button
mountEditor returns { update, destroy }. update(options) takes the full options again, not a patch. One element holds one editor: mounting again takes over the first.

Sizing the Host

  • The layout follows the editor’s own size, not the window’s. A narrow box gets the narrow layout, even on a wide screen.
  • Under 520 px tall, the menu drops to 128 px.
  • Save keeps the inline editor open. The Close button shows only when you pass onClose.

The Whole Page

Set layout: 'page' and the editor becomes the page.
Add viewport-fit=cover to the page’s viewport meta tag, or the safe areas (notch, home indicator) aren’t reported to the editor.
index.html
  • Render it near <body>. It is position: fixed at 100dvh, so an ancestor with a transform, filter, perspective, contain: paint/layout or will-change: transform makes it fill that ancestor instead of the viewport.
  • It locks the page’s scroll while mounted and gives it back on unmount.
  • It sits at a very high z-index, like the modal.

What src Takes

The type is read from the file’s bytes, not its name.

When src Changes

src and state are read when the editor opens. While the empty state, a load or an error screen shows, a new src replaces the one opening. Once an image is on screen, changes are ignored. To open another image, give the editor a new key in React; with mountEditor, destroy it and mount again.
Pass a stable src. A new object on every render, such as URL.createObjectURL(file) written inline, restarts the load each time your component renders while the image loads.

Modal

Open the editor over the page.

Props

Every prop the editor takes.