Tooltip

CSS-only tooltip via a data-tooltip attribute. Shows on :hover and :focus-visible. Always pair with an aria-label — the tooltip is decorative.

Four directions

<button class="btn tooltip" data-tooltip="Hint" aria-label="Copy">Top</button>
<button class="btn tooltip tooltip--bottom" data-tooltip="Hint">Bottom</button>
<button class="btn tooltip tooltip--left" data-tooltip="Hint">Left</button>
<button class="btn tooltip tooltip--right" data-tooltip="Hint">Right</button>

Icon buttons with tooltip

<button class="btn tooltip" data-tooltip="Edit" aria-label="Edit">
  <svg class="icon icon--md">…</svg>
</button>

Modifiers

ClassEffect
.tooltipBase; tooltip renders above on [data-tooltip].
.tooltip--topExplicit top (same as default).
.tooltip--bottomTooltip below the element.
.tooltip--leftTooltip to the left.
.tooltip--rightTooltip to the right.

Accessibility: data-tooltip text is not read by AT. Always add aria-label (or visible text) describing the action.