Popover
Accessible floating panel for interactive contextual content and actions.
- Selector
- ui-popover
- Package
- @ngnova/ui/popover
Import
import { UiPopoverComponent, UiPopoverTriggerDirective, UiPopoverContentDirective } from '@ngnova/ui/popover';Usage & variants
Live examples use the public ui-popover API, paired with the exact snippet a product team would paste into an Angular app.
Account actions popover
Accessible floating panel for interactive contextual content and actions.
Account actions
Manage your current session.
Production guidance
Use these notes to decide when the component belongs in a product workflow and what to verify before shipping.
When to use
Use for contextual actions, lightweight settings, or supporting content that includes controls.
Watch for
The panel flips at viewport edges, clamps along the cross axis, and repositions on resize and scroll.
Product recipes
Apply Popover in distinct, copyable product scenarios—not just an isolated component state.
Account actions
A visible heading labels the non-modal dialog while actions remain keyboard reachable.
1 2 3 4 5 6 7 8
<ui-popover titleId="account-actions-title">
<button uiPopoverTrigger type="button">Account</button>
<div uiPopoverContent>
<h2 id="account-actions-title">Account actions</h2>
<button type="button">Profile</button>
<button type="button">Sign out</button>
</div>
</ui-popover>Schedule settings
Keep lightweight scheduling controls near their trigger without interrupting the surrounding form.
1 2 3 4 5 6 7
<ui-popover placement="bottom-start">
<button uiPopoverTrigger uiButton variant="outline">Schedule</button>
<form uiPopoverContent class="grid w-72 gap-3 p-4">
<ui-date-picker label="Publish date" [formControl]="publishDate" />
<ui-button type="submit">Apply schedule</ui-button>
</form>
</ui-popover>API Reference
Inputs and outputs are semver-sensitive public API. Keep examples aligned with this table.
Inputs
open false boolean Controlled open state; supports two-way binding with openChange.
position 'bottom' 'top' | 'right' | 'bottom' | 'left' Preferred panel side; collision handling can flip it to the opposite side.
ariaLabel '' string Direct accessible panel label when no visible title labels the dialog.
titleId '' string ID of a visible title inside the panel used by aria-labelledby.
panelId generated string Stable panel ID connected to each trigger through aria-controls.
closeOnOutside true boolean Closes the panel after a pointer interaction outside the popover.
closeOnEscape true boolean Closes on Escape and returns focus to the trigger.
uiPopoverTrigger required directive Marks the projected interactive element that toggles the panel.
uiPopoverContent required directive Marks the projected interactive content rendered inside the panel.
| Name | Type | Default | Description |
|---|---|---|---|
open | boolean | false | Controlled open state; supports two-way binding with openChange. |
position | 'top' | 'right' | 'bottom' | 'left' | 'bottom' | Preferred panel side; collision handling can flip it to the opposite side. |
ariaLabel | string | '' | Direct accessible panel label when no visible title labels the dialog. |
titleId | string | '' | ID of a visible title inside the panel used by aria-labelledby. |
panelId | string | generated | Stable panel ID connected to each trigger through aria-controls. |
closeOnOutside | boolean | true | Closes the panel after a pointer interaction outside the popover. |
closeOnEscape | boolean | true | Closes on Escape and returns focus to the trigger. |
uiPopoverTrigger | directive | required | Marks the projected interactive element that toggles the panel. |
uiPopoverContent | directive | required | Marks the projected interactive content rendered inside the panel. |
Outputs
openChange boolean Requests a controlled open-state update.
opened void Emits once when the panel opens.
closed void Emits once when the panel closes.
| Name | Type | Description |
|---|---|---|
openChange | boolean | Requests a controlled open-state update. |
opened | void | Emits once when the panel opens. |
closed | void | Emits once when the panel closes. |
Accessibility
- The panel uses role="dialog" and must receive an accessible name through ariaLabel or a visible titleId.
- Triggers receive aria-haspopup="dialog", aria-expanded, and aria-controls automatically.
- Popover is non-modal: background content remains available and focus is not trapped.
Keyboard behavior
- Enter or Space activates a native button trigger; ArrowDown also opens the panel.
- Escape closes the panel when enabled and restores focus to the trigger.
- Tab follows the normal document order through interactive panel content.
Testing guidance
- Use UiPopoverHarness to open or close the panel and inspect trigger state and projected content.
- Test accessible naming, controlled state, outside and Escape dismissal, collision fallback, and focus restoration.