Popover

A non-modal panel anchored to a trigger, for content that needs more than a tooltip: an explanation with a link, a small form or a preview. The rest of the page stays usable while it is open.

  • vig-popover
  • [vigPopoverTrigger]
  • [vigPopoverContent]
Import
import { Popover, PopoverTrigger, PopoverContent } from '@vigdx/ui/popover';

Basic

Mark the trigger with vigPopoverTrigger and put the panel in an ng-template vigPopoverContent , which is created only while the popover is open. Name the panel with ariaLabel ; otherwise the trigger labels it.

Monthly active users

Form content

Any content works, including form fields. Call close() on a template reference to close the popover from inside — it also returns focus to the trigger.

Open state

Two-way bind [(open)] to read whether the popover is open or to close it from code. The panel opens below the trigger and flips above it when there is no room.

Open: false

Styling hooks

Internal elements carry a stable data-part and the component's data-scope; both are public API, so removing one is a breaking change. Select a part by both, e.g. [data-scope="popover"][data-part="panel"] { … }: the pair stays within this component when kit components nest, and also reaches parts in overlay panels, which render outside the host. State is exposed through aria-* and, where listed, a data-state; literal values are checked by the API gate, values computed from the component's state follow its documented types. Other data-* attributes listed below (such as data-opening while an overlay animates) are API too. See Customizing.

Scope: [data-scope="popover"]

Popover styling hooks
Part Element data-state
panel The role="dialog" panel, rendered in the overlay container. —
Popover data attributes
Attribute Meaning
data-opening On the overlay element (panel or <dialog> ) while its entrance transition plays; removed once it settles (2s at most). Style the entrance with data-opening: utilities.
data-closing On the overlay element while its exit transition plays, before it closes; removed once it settles (2s at most). Style the closed look with data-closing: utilities.

Accessibility

  • The trigger gets aria-haspopup="dialog", aria-expanded and, while open, aria-controls; the panel is a non-modal role="dialog".
  • Opening moves focus onto the panel, so screen readers announce it and Tab reaches its content next. Focus is not trapped.
  • Escape closes the panel and returns focus to the trigger. Clicking outside or tabbing out of the panel closes it as well: the panel renders at the end of the page, so Tab past its last control continues from the trigger and Shift+Tab before its first control returns to the trigger.
  • Opening or closing through a bound [(open)] manages focus the same way, and focus inside a panel that closes for any reason (scrolling, a click on a blank area) goes back to the trigger instead of being lost.
  • Use a real button as the trigger (a vig-button or native <button>), and give icon-only triggers an ariaLabel.

API

Popover

vig-popover component

Anchored non-modal panel for arbitrary content (PrimeNG p-popover / OverlayPanel territory). The content template renders only while open; focus moves onto the panel, Escape and outside interactions close it, and Tab past either end of the panel continues from the trigger. Driving open from outside behaves the same as the trigger.

Example :
<vig-popover ariaLabel="Filters">
  <vig-button vigPopoverTrigger label="Filters" />
  <ng-template vigPopoverContent>…</ng-template>
</vig-popover>

While it plays its entrance or exit transition, the animating element carries data-opening or data-closing (stable hooks for styling and for waiting in tests; see the theming guide). data-opening data-closing

Popover props
Name Type Default Description
ariaLabelstring | undefinedundefined
—
open model booleanfalse

Two-way; also driven by the trigger.

Templates and directives

Templates and directives
Selector Export Description
[vigPopoverTrigger]PopoverTrigger

Wires a projected element as the popover trigger. Works on a native button or on a component wrapping one (e.g. vig-button): the ARIA state lands on the actual interactive element.

[vigPopoverContent]PopoverContent

Marks the lazily instantiated panel content of a vig-popover.

Are you sure?