Skip to main content

Basic and placement

A popover is a small panel opened by a click, next to its button. Unlike a tooltip it can hold links, buttons and fields, so it opens on click (never on hover) and it is not modal: the button has aria-haspopup="true" and aria-controls, the popup script keeps aria-expanded, moves the focus into the panel and closes it with Esc or a click outside, returning the focus to the button. Four placements: top, bottom, left, right. button-text or button-icon renders the button, and button-class adds classes to it. The id is on the root, the button is <id>-button and the panel <id>-panel.

Rich content

Use a popover for a small summary or a quick question. The profile shows more about a name without leaving the page; the confirmation asks before a risky action, and its buttons are closers (they share the aria-controls of the trigger). For a decision with serious consequences use a modal.

With a field

A field inside a popover needs a visible label like any other field. The popup script puts the focus on the first control when the popover opens, so keep the most useful control first. Tab stays free to leave the popover, which then stays open until Esc or a click outside.

Options reference

No script of its own: the popup script of the page handles the popup.

Part Value Description
Trigger aria-haspopup="true", aria-controls, aria-expanded A button. The popup script toggles aria-expanded.
Panel <id>-panel, role="dialog", aria-labelledby Not modal: the rest of the page stays reachable. Hidden with invisible until the trigger is expanded.
Wrapper relative Anchors the panel. The panel shows while the button before it is expanded.
Placement top, bottom, left, right Position classes of the panel. Keep it inside the screen; a wide popover belongs at the bottom on a phone.
Closer button with the same aria-controls Inside the panel: Cancel, Done.
Keys Enter or Space, Esc Open from the button; Esc closes and returns to the button.
Tooltip or popover? hover/focus label vs click panel A tooltip only names or explains; if the person must read, click or type, use a popover.