Popover
Contextual nonmodal surface with explicit focus/dismiss behavior and viewport containment.
Use the web element directly without the semantic runtime.
A registered presentation adapter can bind this component to host-owned meaning and state.
The standard recipe resolver does not select this component automatically.
Import and live example#
One non-modal report-details popover opened beside its trigger.
Interactive preview requires JavaScript.
View the complete example source
import {registerAeliqoElements} from "@varendo/web";
import {
AeliqoAlertElement,
AeliqoDialogElement,
AeliqoDrawerElement,
AeliqoEmptyStateElement,
AeliqoPopoverElement,
AeliqoProgressElement,
AeliqoSkeletonElement,
AeliqoToastElement,
AeliqoTooltipElement,
} from "@varendo/web/feedback";
registerAeliqoElements();
const host = document.querySelector<HTMLElement>("#aeliqo-example") ?? (() => {
const created = document.createElement("div");
created.id = "aeliqo-example";
(document.body ?? document.documentElement).append(created);
return created;
})();
function createCatalogRoot(container: HTMLElement): HTMLElement {
const root = document.createElement("div");
root.dataset.catalogSourceRoot = "true";
root.style.display = "grid";
root.style.gap = "12px";
container.append(root);
return root;
}
function createCatalogElement<T extends HTMLElement>(tagName: string, container: HTMLElement): T {
const element = document.createElement(tagName) as T;
element.setAttribute("data-aeliqo-theme", "light");
container.append(element);
return element;
}
function appendSlottedText(root: HTMLElement, slot: string, textContent: string): void {
const content = document.createElement("span");
content.slot = slot;
content.textContent = textContent;
root.append(content);
}
const root = createCatalogRoot(host);
(((root) => {
const element = createCatalogElement<AeliqoPopoverElement>("aeliqo-popover", root);
element.label = "Report details";
element.content = "The report includes the authorized current scope.";
element.open = true;
element.modal = false;
}))(root);
Purpose#
A contextual surface anchored to a trigger, with an explicit open state and dismissal policy. The host picks nonmodal or modal behavior; the component emits a close request, not an action.
When to use it#
- Small content or actions belong next to the element that opened them.
- The surrounding page should stay usable while the surface is open.
- Open, close, and dismissal need explicit host control.
When to use a different component#
- Use Tooltip for a short explanation with no interaction.
- Use Dialog for a blocking decision that needs modal focus.
Properties and defaults#
The host controls open state and chooses modal behavior; the popover does not execute actions itself.
| Property | Use and ownership | Declared type | Initial value |
|---|---|---|---|
label | Provides the visible label and accessible name for the component. | string | 'Open details' |
content | Provides trusted plain content for the overlay. Do not pass untrusted HTML. | string | '' |
open | Controls whether the overlay or expandable surface is currently open. | boolean | false |
modal | Chooses modal focus containment and background interaction behavior. | boolean | false |
closeOnOutside | Enables or disables close on outside as explicit host-controlled state. | boolean | true |
Events#
| Event | Payload | Emitted | Application responsibility |
|---|---|---|---|
aeliqo-popover-close | The close reason. | After Escape or an allowed outside interaction. | Set open to false and restore focus when appropriate. |
Events cross the component boundary as user proposals. Validate their detail and current authority before applying a business effect.
Listen for aeliqo-popover-close
const element = document.querySelector('aeliqo-popover');<p>element?.addEventListener('aeliqo-popover-close', (event) => {
const proposal = (event as CustomEvent<unknown>).detail;
// Validate the proposal, update host state, then assign controlled properties.
applyProposal(proposal);
});States and failure handling#
Relevant states:
- ready
Expected result: The bounded surface exposes a labelled dialog boundary and emits a close request when dismissed.
Keyboard, focus, and accessibility#
Keyboard behavior:
- Tab
- Enter or Space
- Escape
- focus returns to trigger
Exposed semantics:
- aria-controls
- aria-expanded
- aria-haspopup
- aria-label
- aria-modal
- button
- dialog
- role
- section
Responsive behavior#
Keep the popover inside the viewport and its trigger visible. Choose Dialog if the content cannot fit beside the current task.
Style hooks#
- Shadow parts:
close,popover,trigger - Varendo design tokens referenced:
--aeliqo-color-border,--aeliqo-color-surface,--aeliqo-control-min-target,--aeliqo-elevation-raised,--aeliqo-radius-medium,--aeliqo-radius-small,--aeliqo-space-12,--aeliqo-space-16,--aeliqo-space-4
Related components#
Generated TypeScript declaration#
View generated declaration
export declare class AeliqoPopoverElement extends AeliqoFoundationElement {
static readonly properties: {
label: {
type: StringConstructor;
};
content: {
type: StringConstructor;
};
open: {
type: BooleanConstructor;
reflect: boolean;
};
modal: {
type: BooleanConstructor;
};
closeOnOutside: {
type: BooleanConstructor;
attribute: string;
};
};
static readonly styles: import("lit").CSSResult[];
label: string;
content: string;
open: boolean;
modal: boolean;
closeOnOutside: boolean;
private readonly overlayFocus;
private stopOutside;
protected willUpdate(changed: Map<string, unknown>): void;
protected updated(changed: Map<string, unknown>): void;
private openPopover;
private showModalPopover;
private closePopover;
disconnectedCallback(): void;
private close;
private keydown;
private cancel;
protected render(): import("lit").TemplateResult<1>;
}Version#
This page documents the Varendo 0.6 component contract.
