Loading...
Installation
Install the following dependencies:
Copy and paste the following code into your project.
Loading...
Update the import paths to match your project setup.
Composition
<app-popover> ├── [appPopoverAnchor] (optional) | [appPopoverTrigger] └── <app-popover-content> ├── [appPopoverHeader] (optional) │ ├── [appPopoverTitle] │ └── [appPopoverDescription] ├── content ├── [appPopoverClose] (optional) └── <app-popover-arrow> (optional)
Examples
Default
Loading...
Filters
Loading...
Notifications
Loading...
Placement
Loading...
With Form
Loading...
API Reference
<app-popover>
Inputs
| Input | Type | Default | Description |
|---|---|---|---|
id | string | undefined | generated | Unique identifier used to create IDs for the popover parts. |
ids | Partial<PopoverElementIds> | undefined | — | Overrides generated identifiers for individual parts. |
open | boolean | undefined | — | Open state when controlled. Supports Angular two-way binding. |
defaultOpen | boolean | false | Initial open state when uncontrolled. |
modal | boolean | false | Traps focus and prevents interaction outside while open. |
portalled | boolean | true | Renders content through the portal. Modal popovers are always portalled. |
autoFocus | boolean | true | Moves focus into the content when it opens. |
restoreFocus | boolean | true | Restores focus to the trigger when the popover closes. |
closeOnInteractOutside | boolean | true | Closes the popover after an interaction outside it. |
closeOnEscape | boolean | true | Closes the popover when Escape is pressed. |
positioning | PopoverPositioningOptions | undefined | { placement: "bottom" } | Configures floating-element placement and collision handling. |
initialFocusEl | (() => HTMLElement | null | false) | undefined | — | Returns the element to focus when the popover opens. |
finalFocusEl | (() => HTMLElement | null) | undefined | trigger | Returns the element to focus after the popover closes. |
persistentElements | Array<() => Element | null> | undefined | — | Elements treated as inside the popover for outside-interaction handling. |
translations | PopoverIntlTranslations | undefined | — | Overrides accessible text used by the popover. |
triggerValue | string | null | undefined | — | Active trigger value when controlled. Supports Angular two-way binding. |
defaultTriggerValue | string | null | undefined | null | Initial active trigger value when uncontrolled. |
Use [(open)]="open" and [(triggerValue)]="triggerValue" for two-way binding, or pair each
input with its corresponding change output when using signals.
Outputs
| Output | Type | Description |
|---|---|---|
openChange | boolean | undefined | Emits the updated controlled open state. |
triggerValueChange | string | null | undefined | Emits the updated active trigger value. |
escapeKeyDown | KeyboardEvent | Emits when Escape is pressed while the popover is open. |
focusOutside | PopoverFocusOutsideEvent | Emits when focus moves outside the popover. |
interactOutside | PopoverInteractOutsideEvent | Emits for an interaction outside the popover. |
pointerDownOutside | PopoverPointerDownOutsideEvent | Emits for a pointer-down event outside the popover. |
requestDismiss | CustomEvent | Emits when another layer requests that this one dismiss. |
openChangeDetails | PopoverOpenChangeDetails | Emits detailed information about an open-state change. |
triggerValueChangeDetails | PopoverTriggerValueChangeDetails | Emits details whenever the active trigger changes. |
[appPopoverTrigger]
| Input | Type | Default | Description |
|---|---|---|---|
value | string | undefined | — | Value used to identify this trigger when activated. |
<app-popover-content>
| Input | Type | Default | Description |
|---|---|---|---|
class | string | "" | Additional classes applied to the inner content panel. |
Context, Providers, and Utilities
| Export | Angular API |
|---|---|
PopoverRootProvider | Directive [popover-root-provider] providing an externally created API. |
PopoverContext | Structural directive [popover-context] exposing the root API to a template. |
usePopover(options) | Creates the signal-backed popover machine in an Angular injection context. |
injectPopoverContext() | Injects the nearest popover root context. |
injectPopoverContextCarrier() | Injects the context carrier used across the portal. |
injectPopoverRenderStrategyContext() | Injects the content mounting strategy. |
PopoverImports | Readonly collection containing the Angular popover UI and context helpers. |
Types
| Export | Description |
|---|---|
PopoverApi | Connected popover state and actions. |
PopoverElementIds | Overrides for generated popover part IDs. |
PopoverIntlTranslations | Accessible text used by the popover. |
PopoverMachineProps | Configuration accepted by the underlying state machine. |
PopoverPositioningOptions | Floating-element positioning and collision options. |
PopoverPlacement | Supported floating-element placements. |
PopoverOpenChangeDetails | Details emitted by openChangeDetails. |
PopoverTriggerValueChangeDetails | Details emitted by triggerValueChangeDetails. |
PopoverFocusOutsideEvent | Event emitted by focusOutside. |
PopoverInteractOutsideEvent | Event emitted by interactOutside. |
PopoverPointerDownOutsideEvent | Event emitted by pointerDownOutside. |
PopoverTriggerProps | Properties used to connect a popover trigger. |
UsePopoverOptions | Options accepted by usePopover. |
UsePopoverProps | Root properties supplied to usePopover. |
UsePopoverReturn | Signal-backed machine returned by usePopover. |
Angular
React
Solid
Svelte
Vue