Tooltip Functions
Tooltips are windows following the mouse. They do not take focus away. A tooltip window can contain items of any types.BeginTooltip
bool
Always returns true
EndTooltip
EndTooltip() if BeginTooltip() or BeginItemTooltip() returns true.
SetTooltip
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
if (IsItemHovered(ImGuiHoveredFlags_ForTooltip) && BeginTooltip()) idiom.
bool
True if tooltip should be displayed
SetItemTooltip
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.HoverFlagsForTooltipMouseflags when using mouse input - For keyboard/gamepad navigation,
style.HoverFlagsForTooltipNavflags are used - The default for mouse is
ImGuiHoveredFlags_Stationary | ImGuiHoveredFlags_DelayShort
Customizing Tooltip Timing
You can customize when tooltips appear by using differentImGuiHoveredFlags:
Tooltip on Disabled Items
Best Practices
- Use
SetItemTooltip()for simple text-only tooltips after a widget - Use
BeginItemTooltip()/EndTooltip()for rich content tooltips - Keep tooltip text concise and informative
- Use
ImGuiHoveredFlags_ForTooltipfor consistent tooltip behavior - Consider using delays for frequently hovered items to reduce visual noise
- Wrap long text in tooltips using
PushTextWrapPos() - Use help markers
(?)for additional documentation that doesn’t fit in labels