MiHCM
overlay/@mihcm/ui·v0.21.0·stable

Tooltip

Hover/focus tooltip (web) or long-press tooltip (native). Configurable side and delay.

Use cases

  • Icon-only buttons — label the action for keyboard and screen-reader users.
  • Truncated text — reveal the full string on hover.
  • Supplementary info — explain a control without adding visual clutter.
  • Keyboard shortcuts — display the shortcut alongside the action label.

When NOT to use

  • Interactive content (links, buttons, inputs inside the float) — use Popover.
  • Critical information the user must see without hovering — use Alert or inline text.
  • Long descriptions — keep tooltip text under 80 characters. For more, use a HoverCard.

Sides

SideUse when
topDefault. Works for most inline triggers.
bottomTrigger sits near the top edge of the viewport.
leftTrigger is flush-right (e.g. toolbar end).
rightTrigger is flush-left (e.g. sidebar icons).

Composition

  • Wrap a single focusable child. The tooltip binds onMouseEnter/onFocus to that child automatically.
  • delayMs controls the hover delay (default 700 ms). Set 0 for toolbar-dense UIs where instant feedback matters.
  • content accepts styled React content. Use contentClassName for tokenized width, spacing, and typography classes.
  • Use interactive only when the content must receive pointer events; otherwise keep tooltips passive and prefer Popover for controls.
  • On touch devices (React Native), the tooltip triggers on long-press — no hover available.
  • Popover — interactive floating panel.
  • HoverCard — richer preview on hover.