Skip to content
Theme
endue.ai

Components, Overlays

Tooltip

A short floating hint that appears immediately on mouse enter and on keyboard focus.

Name in code Tooltip

A short floating hint. It appears immediately on mouse enter and on keyboard focus.

When to use

Use it for a short hint on a control. When a control is disabled, the tooltip says why it cannot be pressed.

Appearance

  • The surface is tooltip and the text is tooltip-foreground. In dark, the surface is a Stone tone (#403d37).
  • Text is 12px, weight 500, line height 1.4.
  • Padding is 4×8, the corner radius is 8, and the shadow is shadow-md. The maximum width is 240.
  • It sits 6px from the trigger. The default position is above. When it would overflow, it flips to the opposite side.
  • The shortcut slot (kbd) is an outlined keycap with no fill. It follows the text.

Behavior

  • It does not show for touch or pen.
  • Esc closes it. If the pointer leaves the trigger and moves onto the tooltip within 100ms, it stays.
  • It closes when you press.
  • Only one tooltip shows at a time.

What you provide

  • content: one phrase. If it grows into a long sentence, it is not a tooltip.
  • kbd (optional): a shortcut such as “⌘B”.
  • If the text is the same as the trigger’s name, set describe={false} so the same words are not read twice.

Markup

<div role="tooltip" class="Tooltip_tooltip">
  <span class="Tooltip_content">Collapse sidebar</span>
  <kbd class="Tooltip_kbd">⌘B</kbd>
</div>

The component starts hidden with position: fixed, and a script places it. In a static document, override it with position: static; visibility: visible to draw it.

Don’t

  • Don’t put essential information only in a tooltip.
  • Don’t put buttons or links inside. That is a Popover.