<talos-popover> shows its light-DOM content in a chamfered panel next to a
trigger. It runs on the native Popover API (top layer, light dismiss) and CSS
anchor positioning where the browser has them, and falls back to a computed
position that flips at the viewport edges. The trigger is the element named by
anchor, otherwise the previous element sibling. It receives
aria-haspopup="dialog", aria-controls and a live aria-expanded.
A chip opens a popover
Run 42 · nightly backup
- Status
- 2 retries
- Started
- 14:28:07
- Host
- edge-03
<button class="talos-chip talos-chip--warning" type="button">
<span class="talos-chip__dot"></span>
<span class="talos-chip__kind">Run</span>
<span class="talos-chip__title">nightly backup</span>
<span class="talos-chip__meta">4m</span>
</button>
<talos-popover placement="bottom-start">
<h3>Run 42 · nightly backup</h3>
<dl class="talos-dl talos-dl--inline">…</dl>
</talos-popover>
A click (with no modifier key) toggles it. Esc closes it and returns focus to
the trigger; a pointer press outside the popover and its trigger closes it.
Only one is open at a time: opening one closes every other open popover that
does not contain it. The element takes role="dialog" and is labelled by the
first heading in its content, or by its label attribute when there is none.
Placements
<button class="talos-button talos-button--secondary talos-button--sm" type="button">top-end</button>
<talos-popover placement="top-end" label="top-end">Opens above, aligned to the end edge.</talos-popover>
placement is one of bottom-start (the default), bottom-end, top-start,
top-end, start and end. start and end are logical sides, so they
follow the writing direction. When the preferred side does not fit, the
popover flips; the arrow follows the side it landed on and points at the
trigger’s centre.
Hover trigger
edge-03
eu-west-3 · uptime 41 days · load 0.42
<a class="talos-chip" href="/hosts/edge-03">…</a>
<talos-popover trigger="hover" delay="200" placement="end">
<h3>edge-03</h3>
<p>eu-west-3 · uptime 41 days · load 0.42</p>
</talos-popover>
With trigger="hover", pointer hover and keyboard focus on the trigger open
the popover after delay ms (default 300), and leaving the trigger or the
panel closes it after the same delay. Click on the trigger does nothing, so a
link chip still navigates.
Separate anchor
<button id="inspect-btn" type="button">Inspect</button>
…
<talos-popover anchor="inspect-btn" label="Inspector">…</talos-popover>
Events and scripting
const pop = document.querySelector("talos-popover");
pop.addEventListener("talos:open", (e) => console.log("opened from", e.detail.trigger));
pop.addEventListener("talos:close", () => console.log("closed"));
pop.open = true; // reflects to the open attribute
talos:open and talos:close are composed and bubbling, with
detail = { trigger }. Setting or removing the open attribute (or the
open property) shows or hides the popover from script.
Styling
talos-popover::part(panel) { padding: 16px; }
talos-popover::part(arrow) { display: none; }
talos-popover { --talos-popover-width: 18rem; }
The panel draws the house chamfer itself, because the chamfer engine does not
reach into a shadow root. part="panel" is the box and part="arrow" the
pointer. --talos-popover-width (default 24rem) and
--talos-popover-height (default 32rem) cap its size; the stacking level is
--talos-z-popover.
Attributes
Generated from custom-elements.json in the installed package.
Shared attributes (state, format, static…) behave as the
instrument contract describes.
| Attribute | Type | Default | Description |
|---|---|---|---|
open | boolean | — | present while shown; set or remove it to show or hide (reflects) |
anchor | string | previous element sibling | id of the trigger element. |
placement | string | bottom-start | bottom-start | bottom-end | top-start | top-end | start | end. |
trigger | string | click | click | hover. |
delay | number | 300 | hover open/close delay in ms. Read on render, not observed: set it before the element connects. |
label | string | — | accessible name when the content has no heading. Read on render, not observed: set it before the element connects. |
popover | string | — | Read on render, not observed: set it before the element connects. |
Properties and methods
| Member | Type | Description |
|---|---|---|
.open | boolean | |
.trigger | HTMLElement | null | The element this popover is anchored to, or null. |
Events
| Event | Type | Description |
|---|---|---|
talos:close | CustomEvent<{ trigger }> | Bubbles and is composed. |
talos:open | CustomEvent<{ trigger }> | Bubbles and is composed. |
Slots
(default): Default slot.
CSS parts
::part(arrow), ::part(panel)