Skip to main content

Tooltip Functions

Tooltips are windows following the mouse. They do not take focus away. A tooltip window can contain items of any types.

BeginTooltip

Begin/append a tooltip window.
bool
Always returns true

EndTooltip

Close tooltip. Only call EndTooltip() if BeginTooltip() or BeginItemTooltip() returns true.

SetTooltip

Set a text-only tooltip. Often used after an ImGui::IsItemHovered() check. Override any previous call to SetTooltip().
const char*
Format string (printf-style)

Item Tooltips

Helpers for showing a tooltip when hovering an item.

BeginItemTooltip

Begin/append a tooltip window if preceding item was hovered. This is a shortcut for the if (IsItemHovered(ImGuiHoveredFlags_ForTooltip) && BeginTooltip()) idiom.
bool
True if tooltip should be displayed

SetItemTooltip

Set a text-only tooltip if preceding item was hovered. Override any previous call to SetTooltip(). This is a shortcut for the if (IsItemHovered(ImGuiHoveredFlags_ForTooltip)) { SetTooltip(...); } idiom.
const char*
Format string (printf-style)

Advanced Tooltip Examples

Rich Content Tooltip

Tooltip with Image

Conditional Tooltip

Delayed Tooltip

Stationary Tooltip

Multi-line Tooltip

Tooltip with Color

Table in Tooltip

Help Marker

Tooltip Behavior

Default Behavior

  • By default, tooltips use style.HoverFlagsForTooltipMouse flags when using mouse input
  • For keyboard/gamepad navigation, style.HoverFlagsForTooltipNav flags are used
  • The default for mouse is ImGuiHoveredFlags_Stationary | ImGuiHoveredFlags_DelayShort

Customizing Tooltip Timing

You can customize when tooltips appear by using different ImGuiHoveredFlags:

Tooltip on Disabled Items

Best Practices

  1. Use SetItemTooltip() for simple text-only tooltips after a widget
  2. Use BeginItemTooltip() / EndTooltip() for rich content tooltips
  3. Keep tooltip text concise and informative
  4. Use ImGuiHoveredFlags_ForTooltip for consistent tooltip behavior
  5. Consider using delays for frequently hovered items to reduce visual noise
  6. Wrap long text in tooltips using PushTextWrapPos()
  7. Use help markers (?) for additional documentation that doesn’t fit in labels