hooks
use-popover-context
Code

usePopoverContext

usePopoverContext(): undefined | PopoverStore

Returns the popover store from the nearest popover container.

Returns

undefined | PopoverStore

Example

function Popover() {
  const store = usePopoverContext();
 
  if (!store) {
    throw new Error("Popover must be wrapped in PopoverProvider");
  }
 
  // Use the store...
}

Defined in

node_modules/.pnpm/@ariakit+react-core@0.3.5_react-dom@18.2.0_react@18.2.0/node_modules/@ariakit/react-core/cjs/popover/popover-context.d.ts:15