Skip to content

useWindowDocument

useWindowDocument(): Document

Defined in: renderer/hooks/useWindowState.ts:19

Returns the child window’s Document object.

Use this to portal UI library overlays (Radix UI, Base UI, etc.) to the correct document — Radix’s default is the parent window’s document, which causes portals to render in the wrong window.

In dev/test, the returned Document is wrapped in a Proxy that warns on access after the window closes — catches the common leak of stashing the document in a ref or closure past its lifecycle.

Document

if called outside an open <Window> or <PooledWindow>