Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

662 B
Raw Blame
import { createContext, useContext } from 'react'

/**
 * Typically floating things like popovers and tooltips are portaled to the root of the document, but sometimes
 * you want to portal them to a specific container. This context allows you to
 * specify a container for popovers to portal to.
 *
 * For example the Toolbar or the SessionRecordingPlayer so that in full screen mode
 * the popover is not portaled to the root of the document but to the player.
 */

export const FloatingContainerContext = createContext<HTMLElement | null>(null)

export const useFloatingContainer = (): HTMLElement | null => {
    return useContext(FloatingContainerContext)
}