Create

General

Popover

Copy page View as Markdown Open in ChatGPT Open in Claude

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

Usage#

app.component.ts
import { WdsPopoverComponent } from '@wds/angular/popover';

Put the button in the trigger slot and the content in the default slot. Name the panel with heading (or label when it has no title). For a short text on hover use Tooltip, for a list of actions Dropdown.

Examples#

Default#

A click on the trigger opens the panel below it; heading and description add a title and a description at the top. A click outside, Escape or moving focus out of the panel closes it.

Open popover Width Max. width Height Max. height

Side#

side places the panel bottom (default), top, left or right of the trigger. Without enough space it flips to the other side.

Left
The panel opens on the left.
Top
The panel opens on the top.
Bottom
The panel opens on the bottom.
Right
The panel opens on the right.

Align#

align aligns the panel with the start, center (default) or end of the trigger (in right-to-left text start is the right edge). --wds-popover-width sets the width of the panel (default 18rem).

Start
Aligned to the start.
Center
Aligned to the center.
End
Aligned to the end.

User profile#

Details of a person with actions. Without a visible title, label names the panel.

MS Mira Stone
MS
Mira Stone [email protected] Admin
Product designer in the Growth team. Based in Lisbon, works 9:00–17:00 WET.
Message View profile

Settings#

Quick settings behind an icon button. The changes apply at once, so the panel needs no Save button.

Comments Mentions Weekly summary

Autofocus#

An element with autofocus gets focus when the panel opens, here the field with the link. Without it, focus goes to the panel, and Tab moves to its first control.

Share
Copy

API References#

wds-popover#

Rich content in a floating panel, opened by a button: a short form, details, settings. The panel opens in the top layer (Popover API) next to the trigger and is a non-modal dialog: the rest of the page stays usable. A click outside, Escape or moving focus out of the panel closes it.

Attributes

AttributeTypeDefaultDescription
openbooleanfalseWhether the panel is open. Also set by show(), close() and toggle().
sideWdsPopoverSide'bottom'Side of the trigger. Flips when there is not enough space.
alignWdsPopoverAlign'center'Alignment along the trigger.
offsetnumber4Distance from the trigger in px.
headingstring''Title at the top of the panel; it names the dialog.
descriptionstring''Description under the title, linked as aria-describedby.
labelstring | undefinedAccessible name of the panel when it has no heading.
disabledbooleanfalseDisables opening the panel.

Events

EventDescription
wds-open-changeCustomEvent<WdsPopoverOpenChangeDetail>The panel opens or closes.

Methods

MethodDescription
show()Opens the panel.
close()Closes the panel. Focus goes back to the trigger when it was inside the panel.
toggle()Opens or closes the panel.

Slots

SlotDescription
triggerThe button that opens the panel (e.g. wds-button). It gets aria-haspopup="dialog" and aria-expanded.
(default)Panel content. An element with autofocus gets focus when the panel opens; otherwise the panel itself.

CSS parts (::part)

PartDescription
contentThe panel.
headerTitle and description.
titleThe title.
descriptionThe description.

CSS custom properties

PropertyDescription
--wds-popover-widthWidth of the panel (default 18rem).

Accessibility#

Screen reader#

The panel is a non-modal dialog (role="dialog") named by heading or label; description is linked with aria-describedby.

The trigger gets aria-haspopup="dialog" and aria-expanded; wds-button forwards them to its native button.

When the panel opens, focus moves into it, so screen readers announce its name. Escape returns focus to the trigger.

The panel is not modal: the rest of the page stays available, and moving focus out of the panel closes it.

Keyboard support#

KeyFunction
EnterOn the trigger: opens or closes the panel.
SpaceOn the trigger: opens or closes the panel.
TabMoves focus to the next control in the panel. Moving focus out of the panel closes it.
ShiftTabMoves focus to the previous control.
EscapeCloses the panel and returns focus to the trigger.
Footer