egui::containers::popup

Function show_tooltip_text

Source
pub fn show_tooltip_text(
    ctx: &Context,
    parent_layer: LayerId,
    widget_id: Id,
    text: impl Into<WidgetText>,
) -> Option<()>
Expand description

Show some text at the current pointer position (if any).

Most of the time it is easier to use Response::on_hover_text.

See also show_tooltip.

Returns None if the tooltip could not be placed.

if ui.ui_contains_pointer() {
    egui::show_tooltip_text(ui.ctx(), ui.layer_id(), egui::Id::new("my_tooltip"), "Helpful text");
}