pub struct Tooltip { /* private fields */ }Expand description
A hover-triggered tooltip attached to a Response.
Construct with the body text and optionally layer on a heading or a
keyboard-shortcut row, then call Tooltip::show immediately after
rendering the trigger.
Implementations§
Source§impl Tooltip
impl Tooltip
Sourcepub fn new(body: impl Into<WidgetText>) -> Self
pub fn new(body: impl Into<WidgetText>) -> Self
Create a tooltip with the given body text.
Defaults: anchored above the trigger, no heading, no shortcut row, arrow on, ~8 pt gap between trigger and tooltip.
Sourcepub fn heading(self, heading: impl Into<WidgetText>) -> Self
pub fn heading(self, heading: impl Into<WidgetText>) -> Self
Add a bold heading line above the body.
Sourcepub fn shortcut(self, shortcut: impl Into<String>) -> Self
pub fn shortcut(self, shortcut: impl Into<String>) -> Self
Add a keyboard-shortcut row at the bottom of the tooltip.
The string is split on whitespace and each token is rendered as a
small monospace chip, so "\u{2318} S" renders as two chips.
Sourcepub fn shortcut_label(self, label: impl Into<String>) -> Self
pub fn shortcut_label(self, label: impl Into<String>) -> Self
Override the leading label on the shortcut row. Default: "Shortcut".
Sourcepub fn side(self, side: TooltipSide) -> Self
pub fn side(self, side: TooltipSide) -> Self
Which side of the trigger to anchor on. Default: TooltipSide::Top.
Sourcepub fn width(self, w: f32) -> Self
pub fn width(self, w: f32) -> Self
Fix the tooltip’s max content width, in points. Long body text wraps at this width. Default: 260.
Sourcepub fn arrow(self, arrow: bool) -> Self
pub fn arrow(self, arrow: bool) -> Self
Toggle the small arrow that points at the trigger. Default: on.