@mocanvas/editor · function

useViewportHeight

declare function useViewportHeight(): number

The visual viewport's height in CSS pixels.

Follows the *visual* viewport rather than the layout viewport, which is the only reason this ever existed: on a phone the on-screen keyboard shrinks the visible area without changing window.innerHeight, so an editor sized from the layout viewport puts its toolbar underneath the keyboard.

Returns 0 where there is no DOM, so a server render produces markup rather than throwing.

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.