Overlays

Popover

@xui/popover

A floating panel anchored to its trigger. The base of every Phase 3 overlay preset: tooltip is a hover popover, menu a click popover holding a menu. Positioning, Escape, outside-click and focus all come from @xui/core/overlay, so they cannot be checked in jsdom — these stories are where that behaviour is verified.

Install

pnpm add @xui/popover

Add the barrel to a standalone component's imports:

import { XuiPopoverImports } from '@xui/popover';

@Component({
  imports: [XuiPopoverImports],
  // …
})

Examples

Click

Loading preview…

Hover

Loading preview…

Placements

Loading preview…

Match width

Loading preview…

API

XuiPopoverPanel

componentxui-popover-panel

The floating surface a popover's content sits on.

XuiPopover

directive[xuiPopover]

Anchors a floating panel to the element it sits on.

Inputs

NameTypeDefaultcontentrequiredTemplateRef<unknown>The content to float. Aliased so the selector doubles as the content input.contextRecord<string, unknown>Values the content template destructures with let-.interactionKindXuiPopoverInteractionKindWhat opens the popover: a click or a hover. The -target variants keep the popover open only while the target itself is engaged, rather than bridging to the panel.this.config.interactionKindplacementXPlacementPreferred side and alignment relative to the target. The overlay flips it when there is no room.this.config.placementoffsetnumberGap in pixels between the target and the panel. Ignored when minimal, which sits flush.this.config.offsethoverOpenDelaynumberMilliseconds the pointer must rest on the target before a hover popover opens. Keeps it from firing on the way past.this.config.hoverOpenDelayhoverCloseDelaynumberMilliseconds before a hover popover closes after the pointer leaves — the grace period for crossing the gap into the panel.this.config.hoverCloseDelayminimalbooleanDrop the arrow and the offset, so the panel sits flush against the target. For dropdowns rather than callouts.this.config.minimalmatchTargetWidthbooleanMake the panel exactly as wide as its target. What a select-style dropdown wants.this.config.matchTargetWidthbarebooleanThe content already is a surface, so the panel should only position it. For a picker card, which brings its own background, border and rounding — without this the panel draws a second surface underneath, and its width cap crops the card.falsedisabledbooleanA disabled trigger never opens, and closes the popover if it was open.falsepanelClassClassValueExtra classes for the floating surface.''role'dialog' | 'menu' | 'listbox' | 'grid' | nullARIA role for the pane — menu, listbox, dialog. Null leaves it a plain group.nullariaLabelstring | nullAccessible name for the panel, when its content does not supply one.nullopentwo-waybooleanOpen state. Works bound (controlled) or unbound (the directive toggles it).false

Outputs

NameTypeopenedvoidEmits once the panel is attached.closedvoidEmits once the panel is detached.

Methods

toggle(): voidToggle from a template, e.g. a dedicated open button.show(): voidclose(): void

Source

libs/ui/popover/xui

xUI 2.0.0 — Apache 2.0 licensed. Built with Angular and Tailwind CSS.