Popover

A floating panel anchored to a trigger element. Supports static HTML content or remote AJAX content, hover (default) or click triggers, and smart viewport-aware placement. The popover is rendered to <body> and uses position: absolute so it scrolls naturally with the document — no JavaScript scroll tracking needed. When the popover is clamped near a viewport edge the arrow always adjusts to keep pointing at the trigger element. Popovers are ideal for contextual info cards, user profile previews, and rich tooltips.

Basic Hover Popover

Default behaviour: shows on hover with a short delay, hides when the mouse leaves the trigger or the popover itself. Placement defaults to auto (prefers bottom).

Click Trigger

Use ->triggerOn('click') for click-to-toggle behaviour. Clicking outside the popover or pressing Escape dismisses it.

Placement

Explicit top, bottom, left, and right placements, plus auto (default — flips to top when near the bottom edge).

Remote Content (AJAX)

Use ->remote(url) to load the popover body from an endpoint on first show. Responses are cached per URL by default — set ->cache(false) to always re-fetch. A spinner is shown while loading.

Shared Popover — User Profile Cards

A single popover instance can serve many triggers via ->triggerSelector(). Each trigger passes per-trigger overrides using data-popover-title and data-popover-content (or data-popover-url for AJAX overrides). This is the recommended pattern for user profile cards on a username list.

Mentioned by: @alice, @bob, @carmen
Interact with the examples above to see events here…
PHP

PHP PHP Methods (Fluent)

Method / PropertyParametersDescription
$m->popover($id)PopoverCreate a new popover component.
->title($text)selfSet the header title text.
->content($html)selfSet static HTML for the popover body.
->trigger($elementId)selfBind to a single DOM element by ID.
->triggerSelector($css)selfBind to all elements matching a CSS selector.
->placement($p)selfPlacement: auto (default), top, bottom, left, right.
->align($a)selfHorizontal alignment for top/bottom placements: center (default), start (left-edge), end (right-edge). No effect on left/right placements.
->triggerOn($event)selfTrigger event: hover (default) or click.
->delay($show, $hide)selfShow/hide delays in ms. Default: 200 / 300.
->remote($url)selfLoad body content from a URL via AJAX.
->cache($bool)selfCache remote responses per URL. Default: true.
->width($css)selfForce a specific CSS width, e.g. '300px'.
->offset($px)selfGap between trigger and popover in pixels. Default: 8.

JS JS Methods

Method / PropertyParametersDescription
m.popover(id)object|nullGet a popover instance by ID (auto-inits on DOMContentLoaded).
pop.show(triggerEl)Show the popover anchored to an element.
pop.hide()Hide the popover.
pop.toggle(triggerEl)Toggle visibility for a trigger element.
pop.setContent(html)Replace the body with arbitrary HTML.
pop.setTitle(text)Update the header title text.
pop.loadContent(url, force)Fetch content from a URL. Pass true to bypass cache.
pop.bindTrigger(el)Bind a DOM element as a trigger (safe to call multiple times).
pop.refresh()Re-scan the DOM for new trigger elements matching the configured selector.
pop.elementHTMLElementThe underlying popover DOM element.

EVENT Events

Event NameDetailDescription
m:popover:show{ id, trigger }Fired on the popover element when it becomes visible.
m:popover:hide{ id }Fired when the popover is hidden.
m:popover:content-loaded{ id, url }Fired after remote content is successfully loaded and injected.