Function egui::containers::popup::show_tooltip

source ยท
pub fn show_tooltip<R>(
    ctx: &Context,
    parent_layer: LayerId,
    widget_id: Id,
    add_contents: impl FnOnce(&mut Ui) -> R,
) -> Option<R>
Expand description

Show a tooltip at the current pointer position (if any).

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

See also show_tooltip_text.

Returns None if the tooltip could not be placed.

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