Skip to content
Fleetline

Popover

Usage

Use a popover for a small amount of related, optional content next to its trigger: a vehicle summary from a table row, quick actions on a work order, a short form like "Snooze reminder". The page stays usable while it's open, and clicking outside or pressing Esc closes it.

Anatomy

  1. Trigger — a <button> with commandfor + command="toggle-popover" and an anchor-name
  2. Surface — <div class="popover" popover role="dialog">, overlay surface and shadow
  3. Header (optional) — .popover__title and a close button
  4. Body — .popover__body, may contain links and controls
  5. Footer (optional) — .popover__footer actions
  6. Arrow (optional) — .popover__arrow, decorative

Examples

Popover

Closed: the trigger only. Activate it to open the real popover below the button.

Vehicle KX-24

Ford Transit, Northside Depot. 85,200 km — brake inspection is 1,200 km overdue.

Odometer synced 4 min ago from the KX-24 telematics unit.

Placements are logical, so "inline start" is the left in English and the right in Arabic. Near a viewport edge the popover flips with the shared --flip-block / --flip-inline tries.

<button type="button" class="btn btn--secondary" commandfor="pop-kx24" command="toggle-popover"
        style="anchor-name: --pop-kx24">KX-24 details</button>

<div id="pop-kx24" class="popover" popover role="dialog" aria-labelledby="kx24-title"
     style="position-anchor: --pop-kx24">
  <div class="popover__header">
    <h4 class="popover__title" id="kx24-title">Vehicle KX-24</h4>
    <button type="button" class="btn btn--ghost btn--sm" commandfor="pop-kx24" command="hide-popover" aria-label="Close">…</button>
  </div>
  <div class="popover__body"><p>…</p></div>
  <div class="popover__footer">…</div>
</div>

<!-- Arrow and placements -->
<div class="popover popover--arrow" popover><span class="popover__arrow" aria-hidden="true"></span>…</div>
<div class="popover popover--block-start | popover--inline-start | popover--inline-end" popover>…</div>

API

HookValuesPurpose
.popover[popover]blockSurface; popover (auto) gives light dismiss and Esc
commandfor="id" command="toggle-popover | show-popover | hide-popover"invoker attributesOpen/close without JS; the browser exposes the expanded state on the trigger
anchor-name / position-anchorinline style per instanceTies the surface to its trigger
.popover--block-start | --inline-start | --inline-endmodifierPreferred placement (default below, aligned to the inline start)
.popover--arrow + .popover__arrowmodifier + partPointer toward the trigger (block placements)
.popover__header | __title | __body | __footerpartsSee anatomy
.is-opendocs-only classRenders an open popover in page flow (same rule as :popover-open)

Do and don't

Vehicle summary + "Schedule service" in a popover next to the row.

Do keep popovers short and related to their trigger.

A 12-field "Edit vehicle" form inside a popover.

Don't put long forms in a popover: a stray click outside discards them. Use a modal or a page.

Accessibility

Keyboard interaction
KeyBehavior
Enter / Space on triggerToggles the popover
TabFrom the trigger moves into the popover (it follows the trigger in focus order); can leave it — not a trap
EscCloses the popover and returns focus to the trigger

Tokens

Custom propertyPurpose
--color-elevation-surface-overlaySurface
--overlay-radius, --overlay-shadowShape and elevation
--color-border-defaultBorder and arrow edge
--space-2 | -3Gap to the trigger (larger with arrow)
--motion-duration-base | -fast, --motion-easing-enter | -exitFade in and out