Skip to content

CSS: tooltip ​

.instui-tooltip — Bublóg tooltip CSS le hover agus fócas, is féidir í a shocrú ar aon thaobh.

Is CSS ghlan é an lascáil (:hover/:focus-within), mar sin ní fhaigheann ach úsáideoirí méarchláir rochtain ar an bublóg trí spreagthóir infhócasaithe; murach popover, níl sé in-mhúchta ná spreagtha le cliceáil.

Source: tooltip.css

TIP

Feabhsú JS — Cuireann CSS an chomhpháirte seo léiriú agus oibríocht air dá chuid féin; comhcheangail é le @pantoken/interactions chun an iompar idirghníomhach a chur leis. Féach an tábla modhnóirí thíos.

Inrochtaineacht ​

Dírigh an spreagthóir chuig an bublóg leis an aria-describedby agus tabhair role="tooltip" don bublóg.

Úsáid ​

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

Samplaí ​

html
<span class="instui-tooltip">
  <button class="instui-button" type="button" aria-describedby="placement-tip">Suíomh</button>
  <span class="tip -placement-bottom" id="placement-tip" role="tooltip">Taispeánann an leide seo thíos.</span>
</span>

Struchtúr ​

text
.instui-tooltip
  [class*="-icon-"] (0..1)
  .tip
flowchart TD n0[".instui-tooltip"]:::cssdoc-root n1("[class*=&quot;-icon-&quot;]"):::cssdoc-part n2(".tip"):::cssdoc-part n0 -.->|0..1| n1 n0 --> n2 classDef cssdoc-root stroke-width:1px; classDef cssdoc-part stroke-width:1px; classDef cssdoc-slot stroke-width:1px; classDef cssdoc-component stroke-width:1px;

Modhnóirí ​

ModhnóirCur síos
.-icon-*Léirigh íocón glyf spreagthóra in aice leis an bublóg tooltip.

Codanna ​

CuidCur síos
.tipAn bublóg; socraíonn -placement-* a thaobh.

Tóicíní a úsáideadh ​

TokenCineálLuach
--instui-border-radius-sm<length>0.25rem
--instui-color-background-inverse<color>LightDarklight-dark(#334450, #F2F4F5)
--instui-color-text-inverse<color>LightDarklight-dark(#ffffff, #1C222B)
--instui-component-tooltip-font-family[ <font-family-name> | <generic-font-family> ]#Atkinson Hyperlegible Next, "Helvetica Neue", Helvetica, Arial, sans-serif
--instui-component-tooltip-font-size<length>0.875rem
--instui-component-tooltip-font-weight<integer>400
--instui-component-tooltip-padding<length>0.75rem
--instui-spacing-space-xs<length>0.25rem

Gaolmhar ​

  • popover — An dromchla nasctha níos mó, spreagtha le cliceáil.
  • context-view — Dromchla nasctha gaolmhar le táscaire.