Popover
vig-popover [vigPopoverTrigger] [vigPopoverContent]
import { Popover, PopoverTrigger, PopoverContent } from '@vigdx/ui/popover';Basic
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.
Form content
close() on a template reference to close the popover from inside — it also returns focus to the trigger.
Open state
[(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.
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"]
| Part | Element | data-state |
|---|---|---|
panel | role="dialog" panel, rendered in the overlay container. | — |
| Attribute | Meaning |
|---|---|
data-opening | <dialog> ) while its entrance transition plays; removed once it settles (2s at most). Style the entrance with data-opening: utilities. |
data-closing | data-closing: utilities. |
Accessibility
- The trigger gets
aria-haspopup="dialog",aria-expandedand, while open,aria-controls; the panel is a non-modalrole="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-buttonor native<button>), and give icon-only triggers anariaLabel.
API
Popover
vig-popoverAnchored 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.
<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
| Name | Type | Default | Description |
|---|---|---|---|
ariaLabel | string | undefined | undefined | — |
open | boolean | false | Two-way; also driven by the trigger. |
| Name | Payload | Description |
|---|---|---|
openChange | boolean | Two-way; also driven by the trigger. |
| Signature | Description |
|---|---|
close(refocus = true): void | — |
openPanel(): void | — |
toggle(): void | — |
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. |