Skip to content

Vizel API / core/src / createVizelPopoverController

Function: createVizelPopoverController()

ts
function createVizelPopoverController(options): VizelPopoverController;

Defined in: packages/core/src/controllers/popoverController.ts:89

Build a controller for an anchored popover.

The controller delegates to @vizel/headless's popover primitive, which composes @floating-ui/dom positioning with the dismissable listener wiring. The wrapper exists so existing @vizel/core call sites keep importing createVizelPopoverController from Core; the implementation lives in the headless package, and the headless popover de-duplicates the dismiss logic that previously lived in a separate Core controller.

The controller composes two concerns under one { mount, unmount } lifecycle:

  1. Positioning. On mount() and whenever the window resizes or scrolls (configurable), the body positions against the anchor with viewport-edge fallback when the preferred side would overflow.
  2. Dismissal. A pointer event whose target is contained neither in the anchor nor in the body invokes onDismiss. Escape invokes onDismiss when dismissOnEscape stays enabled.

Server-Side Rendering (SSR) safe: every method short-circuits when document is unavailable.

Parameters

ParameterType
optionsVizelPopoverControllerOptions

Returns

VizelPopoverController

Released under the MIT License.