usePopoverContext
Hook to access the nearest Popover compound-component context
Import
import { usePopoverContext } from "@videojs/react";Usage
Use this hook to build a custom part rendered inside Popover.Root.
function ClosePopoverButton() {
const { popover } = usePopoverContext();
return <button onClick={() => popover.close()}>Close popover</button>;
}The hook throws when there is no surrounding Popover.Root.
API Reference
Return Value
| Property | Type | Details |
|---|---|---|
core | PopoverCore | |
popover | object | |
| ||
state | PopoverCore.State | |
preferredSide | PopoverCore.State['side'] | |
setPositionedSide | function | |
| ||
stateAttrMap | { [Key in keyof State]?: string; } | |
anchorName | string | |
popupId | string | |
boundary | 'viewport' | 'container' | string & o... | |
| ||
container | object | null | |