Skip to content

Popover

The bq-popover component is a rich overlay anchored to a trigger. Unlike bq-tooltip — hover-activated and text-only — a popover holds interactive content, opens on click, and manages focus.

Basic Usage

html
<bq-popover heading="Filters">
  <bq-button slot="trigger">Open filters</bq-button>
  Choose how results are sorted.
</bq-popover>

Placement

html
<bq-popover placement="top">…</bq-popover>
<bq-popover placement="bottom-start">…</bq-popover>
<bq-popover placement="right">…</bq-popover>

Supported values are top, bottom, left and right, each optionally suffixed with -start or -end to align to an edge instead of the centre.

html
<bq-popover heading="Delete project">
  <bq-button slot="trigger" variant="danger">Delete</bq-button>
  This cannot be undone.
  <bq-button slot="footer" variant="ghost">Cancel</bq-button>
  <bq-button slot="footer" variant="danger">Delete</bq-button>
</bq-popover>

Without Chrome

html
<bq-popover dismissible="false" arrow="false">
  <bq-button slot="trigger">Details</bq-button>
  Just the content.
</bq-popover>

Controlling It

js
popover.setAttribute('open', '');   // open
popover.removeAttribute('open');    // close

popover.addEventListener('bq-open', () => console.log('opened'));
popover.addEventListener('bq-close', () => console.log('closed'));

Properties

PropertyTypeDefaultDescription
openbooleanfalseWhether the popover is open
placementstring'bottom'top | bottom | left | right (+ -start/-end)
headingstring''Optional title
dismissiblebooleantrueShow a close button
arrowbooleantrueRender a pointer arrow

Slots

SlotDescription
triggerElement that toggles the popover
(default)Popover content
footerFooter actions

Events

EventDetailDescription
bq-openThe popover opened
bq-closeThe popover closed

CSS Parts

PartDescription
panelThe popover panel
arrowThe pointer arrow
headerHeader row
headingTitle element
closeClose button
contentContent wrapper
footerFooter wrapper

Accessibility

  • The panel exposes role="dialog", labelled by the heading when one is set.
  • The trigger receives aria-expanded, aria-haspopup="dialog" and aria-controls, kept in sync as the popover opens and closes.
  • Opening moves focus to the first focusable element in the panel; Escape and the close button return focus to the trigger.
  • Clicking outside closes the popover. That document listener only exists while the popover is open and is removed on disconnect.
  • Use a genuinely focusable element (a button) in the trigger slot so keyboard users can reach it.

Released under the MIT License.