pub struct Popover { /* private fields */ }Expand description
A click-to-toggle popover anchored to a trigger Response.
Call Popover::show immediately after painting the trigger; the
popover toggles open on trigger clicks and closes on outside-click,
Esc, or a subsequent trigger click.
Implementations§
Source§impl Popover
impl Popover
Sourcepub fn new(id_salt: impl Hash) -> Self
pub fn new(id_salt: impl Hash) -> Self
Create a popover keyed by id_salt. The salt is used to persist
the open/closed state across frames and must be stable for the
trigger it’s attached to.
Sourcepub fn popup_id(id_salt: impl Hash) -> Id
pub fn popup_id(id_salt: impl Hash) -> Id
The internal popup id for a given id_salt.
Use this with egui::Popup::open_id / egui::Popup::close_id
to open or close a popover programmatically (for example, from a
keyboard shortcut or a test harness).
Sourcepub fn side(self, side: PopoverSide) -> Self
pub fn side(self, side: PopoverSide) -> Self
Which side of the trigger to anchor on. Default: PopoverSide::Bottom.
Sourcepub fn title(self, title: impl Into<WidgetText>) -> Self
pub fn title(self, title: impl Into<WidgetText>) -> Self
Add a strong title row above the body.
Sourcepub fn width(self, width: f32) -> Self
pub fn width(self, width: f32) -> Self
Fix the popover’s content width. When unset, the popover sizes
itself to the content and its min_width.
Sourcepub fn gap(self, gap: f32) -> Self
pub fn gap(self, gap: f32) -> Self
Gap between the trigger and the popover, in points. Default: 8.