Skip to content

CSS: popover

.instui-popover — Một bề mặt nâng cao cho một [popover] gốc, được định vị bằng định vị neo của CSS.

Định vị neo chỉ có trên Chromium; rào chắn @supports có nghĩa là -placement-* sẽ im lặng không hoạt động ở nơi khác và UA sẽ căn giữa popover trong lớp trên cùng thay vì bị lỗi.

Source: popover.css

Sử dụng

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

Các ví dụ

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>

Cấu trúc

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;

Bộ sửa

Bộ sửaMô tả
.-placement-bottomHiển thị phía dưới mốc neo.
.-placement-endHiển thị ở cuối (inline-end) của mốc neo.
.-placement-startHiển thị ở đầu (inline-start) của mốc neo.
.-placement-topHiển thị phía trên mốc neo.

Điều kiện

KiểuTruy vấnMô tả
supports(position-area: block-end)
supports(transition-behavior: allow-discrete)

Token tiêu thụ

TokenKiểuGiá trị
--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

Hỗ trợ trình duyệt

  • Sử dụng định vị neo của CSS (position-anchor/position-area) và API gốc [popover], cả hai hiện chỉ có trên Chromium; một rào chắn @supports giữ cho vị trí không hoạt động ở những nơi khác, nơi UA căn giữa popover trong lớp trên cùng.

Các thành phần phụ

Liên quan

  • tooltip — Tooltip là một bề mặt neo nhỏ hơn, được kích hoạt khi hover hoặc focus.
  • context-view — Context view là một bề mặt neo liên quan có một mũi tên chỉ.