Skip to content

CSS: tooltip ​

.instui-tooltip — A hover and focus tooltip bubble, positionable on any side.

Load @pantoken/interactions/tooltip.iife.js for managed delays, Escape dismissal, and combined pointer/focus state. Without JavaScript, hover/focus remains a fallback without Escape or delay guarantees. Use a popover for interactive content.

Source: tooltip.css

TIP

JS Enhancement — This component's CSS renders and works on its own; pair it with @pantoken/interactions to add the interactive behavior. See the modifier table below.

Usage ​

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

Demo ​

Examples ​

html
<span class="instui-tooltip">
  <button class="instui-button" type="button" aria-describedby="placement-tip">Placement</button>
  <span class="tip -placement-bottom" id="placement-tip" role="tooltip">This tooltip appears below.</span>
</span>

Structure ​

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;

Modifiers ​

ModifierDescription
.-icon-*Render a trigger glyph icon next to the tooltip bubble.

Parts ​

PartDescription
.tipThe bubble; -placement-* sets its preferred side. Initialized tooltips flip/clamp to fit the viewport.

Pseudo-elements ​

Pseudo-elementDescription
::before—

Conditions ​

TypeQueryDescription
media(prefers-reduced-motion: no-preference)—

Accessibility ​

Use a named, focusable trigger with aria-describedby pointing at the role="tooltip" bubble. Keep the content noninteractive. Initialized tooltips stay dismissed after Escape until both pointer and focus leave; the next entry can reopen them.

ConditionsRebrand (light)Rebrand (dark)CanvasCanvas High Contrast
forced-colors-focus-visibleWCAG 2.2 1.4.11, 2.4.7PassPassPassPass
more-contrast-respectedWCAG 2.2 1.4.3, 1.4.6PassPassPassPass
reduced-motion-respectedWCAG 2.2 2.3.3, 2.2.2PassNot applicablePassPass
reflow-at-320pxWCAG 2.2 1.4.10PassPassPassPass
text-spacing-no-clippingWCAG 2.2 1.4.12PassPassPassPass
InteractionsRebrand (light)Rebrand (dark)CanvasCanvas High Contrast
appears-on-focusWCAG 2.2 1.4.13PassPassPassPass
content-reachable-on-hoverWCAG 2.2 1.4.13PassPassPassPass
escape-dismissesWCAG 2.2 1.4.13PassPassPassPass
focus-indicator-visibleWCAG 2.2 2.4.7PassPassPassPass
no-focus-trapWCAG 2.2 2.1.2PassPassPassPass
trigger-reachable-by-tabWCAG 2.2 2.1.1PassPassPassPass
Computed stylesRebrand (light)Rebrand (dark)CanvasCanvas High Contrast
boundary-contrastWCAG 2.2 1.4.11PassPassPassPass
focus-indicator-contrastWCAG 2.2 1.4.11, 2.4.13PassPassPassPass
text-contrast-by-stateWCAG 2.2 1.4.3PassPassPassPass
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-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
--pantoken-tooltip-gap——
--pantoken-tooltip-viewport-inline-size<length>—
  • popover — The larger, click-triggered anchored surface.
  • context-view — A related anchored surface with a pointer.