Skip to content

CSS: popover ​

.instui-popover — An elevated surface for a native [popover], positioned with CSS anchor positioning.

Anchor positioning is Chromium-only; the @supports guard means -placement-* is silently inert elsewhere and the UA centers the popover in the top layer instead of failing.

Source: popover.css

Usage ​

css
@import "@pantoken/components/components.css";
@import "@pantoken/components/popover.css";

Examples ​

html
<div class="instui-popover -placement-bottom" id="pop-1">
  <div class="instui-heading -level-h4">Share this page</div>
  <p class="instui-text -size-sm">A popover is a lightweight surface anchored to a trigger. This one uses the native <code>popover</code> attribute.</p>
</div>

Structure ​

text
.instui-popover
  heading (component)
  text (component)
    code
flowchart TD n0[".instui-popover"]:::cssdoc-root n1(["heading"]):::cssdoc-component n2(["text"]):::cssdoc-component n3("code"):::cssdoc-part n0 --> n1 n2 --> n3 n0 --> n2 click n1 "/api/css/heading.md" click n2 "/api/css/text.md" classDef cssdoc-root stroke-width:1px; classDef cssdoc-part stroke-width:1px; classDef cssdoc-slot stroke-width:1px; classDef cssdoc-component stroke-width:1px;

Modifiers ​

ModifierDescription
.-placement-bottomSit below the anchor.
.-placement-endSit at the end (inline-end) of the anchor.
.-placement-startSit at the start (inline-start) of the anchor.
.-placement-topSit above the anchor.

Conditions ​

TypeQueryDescription
supports(position-area: block-end)—
supports(transition-behavior: allow-discrete)—
media(prefers-reduced-motion: no-preference)—

Accessibility ​

Wire the trigger with popovertarget so the expanded state is exposed. A native popover closes on Escape and outside click but doesn't move focus, so move focus into interactive content when the popover opens.

ConditionsRebrand (light)Rebrand (dark)CanvasCanvas High Contrast
forced-colors-focus-visibleWCAG 2.2 1.4.11, 2.4.7PassPassPassPass
less-contrast-stays-readableWCAG 2.2 1.4.3PassPassPassPass
more-contrast-respectedWCAG 2.2 1.4.3, 1.4.6PassPassPassPass
reflow-at-320pxWCAG 2.2 1.4.10PassPassPassPass
text-spacing-no-clippingWCAG 2.2 1.4.12PassPassPassPass
Screen reader (simulated)Rebrand (light)Rebrand (dark)CanvasCanvas High Contrast
AnnouncementsPassPassPassPass

These automated results do not establish that the page meets WCAG; manual review is still needed.

Tokens consumed ​

TokenTypeValue
--instui-border-width-sm<length>0.0625rem
--instui-color-background-elevated-surface-base<color>LightDarklight-dark(#ffffff, #171B21)
--instui-color-text-base<color>LightDarklight-dark(#273540, #F2F4F5)
--instui-component-popover-border-color<color>LightDarklight-dark(#8D959F, #6A7883)
--instui-component-popover-border-radius<length>0.75rem
--instui-elevation-abovenone | <shadow>#—
--instui-spacing-space-sm<length>0.5rem

Browser support ​

  • Uses CSS anchor positioning (position-anchor/position-area) and the native [popover] API, both Chromium-only today; an @supports guard keeps the placement inert elsewhere, where the UA centres the popover in the top layer.

Subcomponents ​

  • tooltip — A tooltip is a smaller, hover- or focus-triggered anchored surface.
  • context-view — Context view is a related anchored surface with a pointer.