Skip to content

Tooltip

A short label with an arrow, beside the control it describes, legible over any background in either theme.

  • .aparte-tabs--segmented
On this page
Open

.aparte-tooltip is a short label in a dark chip with an arrow. Its colours are fixed rather than themed, on purpose: it has to stay legible over whatever it covers, a bright image or a dark code block, in either theme.

Wrap the trigger and the tooltip in .aparte-tooltip-anchor and set data-side (top, bottom, start or end): the tooltip sits on that side, --aparte-tooltip-gap away, with its arrow turned to match. Showing it on hover and focus is your script’s or your CSS’s, and so is keeping it on screen near an edge. It never catches the pointer itself.

VariableDefault
--aparte-tooltip-shadow0 2px 8px rgba(0, 0, 0, 0.12)
--aparte-tooltip-gapvar(--aparte-space-3)
--aparte-tooltip-bgvar(--aparte-text)
--aparte-tooltip-colorvar(--aparte-text-inverse)
--aparte-tooltip-max-width—

.aparte-tabs--segmented · .aparte-tabs__tab · .aparte-tooltip · .aparte-tooltip-anchor · .aparte-tooltip__arrow

  • Give the tooltip role="tooltip" and an id, and point the trigger at it with aria-describedby; show it on focus as well as on hover, and hide it on Escape.
  • A tooltip is a hint: anything the reader must know belongs in the page.
  • Popover — a floating box you can act in.
  • Button — the icon buttons tooltips usually describe.