API ReferenceFunctionsregisterOverlayPortal

registerOverlayPortal

Register a node as an Overlay Portal, enabling interaction beneath the Puck overlay.

import { registerOverlayPortal } from "@measured/puck"; const MyComponent = () => { const ref = useRef(null); useEffect(() => registerOverlayPortal(ref.current), [ref.current]); return <button ref={ref}>Clickable</button>; };

Args

ParamExampleTypeStatus
eldivHTMLElement-
opts{}Config-

el

The element to turn into a portal. Will do nothing if null or undefined.

opts

ParamExampleTypeStatus
disableDragfalseboolean-
disableDragOnFocusfalseboolean-

opts.disableDrag

Disable triggering a drag of the parent component when interacting with this element. Defaults to false.

opts.disableDragOnFocus

Disable triggering a drag of the parent component when interacting with this element once it is focused. Drag is disabled following a short delay after focusing. Defaults to true.

Returns

A function to clean-up the portal.