@mocanvas/editor · function

useContainerIfExists

declare function useContainerIfExists(): HTMLElement | null

The editor's container element, or null when there is none.

The tolerant reading: for a component that is useful both inside the editor and standing alone — a shape body rendered into an export, a panel under test — and that has a sensible fallback for "no container".

mocanvas is built by Symbio. Free for non-commercial, non-profit and development use; commercial use needs an agreement. Not affiliated with or endorsed by tldraw.