pub fn popup_above_or_below_widget<R>(
    ui: &Ui,
    popup_id: Id,
    widget_response: &Response,
    above_or_below: AboveOrBelow,
    add_contents: impl FnOnce(&mut Ui) -> R
) -> Option<R>
Expand description

Shows a popup above or below another widget.

Useful for drop-down menus (combo boxes) or suggestion menus under text fields.

The opened popup will have the same width as the parent.

You must open the popup with Memory::open_popup or Memory::toggle_popup.

Returns None if the popup is not open.

let response = ui.button("Open popup");
let popup_id = ui.make_persistent_id("my_unique_id");
if response.clicked() {
    ui.memory_mut(|mem| mem.toggle_popup(popup_id));
}
let below = egui::AboveOrBelow::Below;
egui::popup::popup_above_or_below_widget(ui, popup_id, &response, below, |ui| {
    ui.set_min_width(200.0); // if you want to control the size
    ui.label("Some more info, or things you can select:");
    ui.label("…");
});