Search documentation

Search the documentation and open a page.

Displays rich content in a portal, triggered by a button.

Loading...

Installation

pnpm dlx shadcn@latest add @wirekyt/popover

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

InputTypeDefaultDescription
idstring | undefinedgeneratedUnique identifier used to create IDs for the popover parts.
idsPartial<PopoverElementIds> | undefined—Overrides generated identifiers for individual parts.
openboolean | undefined—Open state when controlled. Supports Angular two-way binding.
defaultOpenbooleanfalseInitial open state when uncontrolled.
modalbooleanfalseTraps focus and prevents interaction outside while open.
portalledbooleantrueRenders content through the portal. Modal popovers are always portalled.
autoFocusbooleantrueMoves focus into the content when it opens.
restoreFocusbooleantrueRestores focus to the trigger when the popover closes.
closeOnInteractOutsidebooleantrueCloses the popover after an interaction outside it.
closeOnEscapebooleantrueCloses the popover when Escape is pressed.
positioningPopoverPositioningOptions | 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) | undefinedtriggerReturns the element to focus after the popover closes.
persistentElementsArray<() => Element | null> | undefined—Elements treated as inside the popover for outside-interaction handling.
translationsPopoverIntlTranslations | undefined—Overrides accessible text used by the popover.
triggerValuestring | null | undefined—Active trigger value when controlled. Supports Angular two-way binding.
defaultTriggerValuestring | null | undefinednullInitial active trigger value when uncontrolled.

Outputs

OutputTypeDescription
openChangeboolean | undefinedEmits the updated controlled open state.
triggerValueChangestring | null | undefinedEmits the updated active trigger value.
escapeKeyDownKeyboardEventEmits when Escape is pressed while the popover is open.
focusOutsidePopoverFocusOutsideEventEmits when focus moves outside the popover.
interactOutsidePopoverInteractOutsideEventEmits for an interaction outside the popover.
pointerDownOutsidePopoverPointerDownOutsideEventEmits for a pointer-down event outside the popover.
requestDismissCustomEventEmits when another layer requests that this one dismiss.
openChangeDetailsPopoverOpenChangeDetailsEmits detailed information about an open-state change.
triggerValueChangeDetailsPopoverTriggerValueChangeDetailsEmits details whenever the active trigger changes.

[appPopoverTrigger]

InputTypeDefaultDescription
valuestring | undefined—Value used to identify this trigger when activated.

<app-popover-content>

InputTypeDefaultDescription
classstring""Additional classes applied to the inner content panel.

Context, Providers, and Utilities

ExportAngular API
PopoverRootProviderDirective [popover-root-provider] providing an externally created API.
PopoverContextStructural 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.
PopoverImportsReadonly collection containing the Angular popover UI and context helpers.

Types

ExportDescription
PopoverApiConnected popover state and actions.
PopoverElementIdsOverrides for generated popover part IDs.
PopoverIntlTranslationsAccessible text used by the popover.
PopoverMachinePropsConfiguration accepted by the underlying state machine.
PopoverPositioningOptionsFloating-element positioning and collision options.
PopoverPlacementSupported floating-element placements.
PopoverOpenChangeDetailsDetails emitted by openChangeDetails.
PopoverTriggerValueChangeDetailsDetails emitted by triggerValueChangeDetails.
PopoverFocusOutsideEventEvent emitted by focusOutside.
PopoverInteractOutsideEventEvent emitted by interactOutside.
PopoverPointerDownOutsideEventEvent emitted by pointerDownOutside.
PopoverTriggerPropsProperties used to connect a popover trigger.
UsePopoverOptionsOptions accepted by usePopover.
UsePopoverPropsRoot properties supplied to usePopover.
UsePopoverReturnSignal-backed machine returned by usePopover.