Tooltip
Passive, measured text hints that follow hovered widgets.
Attach a hint to a control's response:
let response = ui.button("Apply");
ui.tooltip(response, "Save the current settings.");Or in one expression, which also works for labels and disabled controls and keeps the hint in the same layout capture:
use zaxis::{Button, Widget};
let response = ui.add(Button::new("Reset").tooltip("Restore the default settings."));Widget::tooltip(text) is shorthand for Tooltip::new(text).wrap(widget); both forms
and Ui::tooltip stay available.
Hints are enabled by default and appear after 350 ms of hovering. They disappear when the pointer leaves, a mouse button is held, the target disappears or the application loses focus. They never capture input or change keyboard focus.
Style::tooltip contains enabled, delay, max_width, padding, rounding,
and optional fill, text_color, border overrides. Colors otherwise follow
the current UI style. Tooltip::style replaces these defaults for one hint;
Tooltip::enabled explicitly overrides its enabled state.
The box is measured independently of the target width, wraps at words and uses the shared Unicode shaper for long words. It follows final layout and scroll placement, escapes parent clipping, and fits the viewport below or above the target. On short viewports it can grow wider to keep all lines visible. Text larger than the entire viewport should be shown in a scrollable panel instead.
Accessibility
The tooltip text becomes the description of its widget, whether the tooltip is shown or
not, unless the widget already has a description or is named by the same text. The
widget accepts ShowTooltip and HideTooltip. While shown, the tooltip is a Tooltip
layer. A tooltip switched off with enabled(false) says
nothing; one hidden only by TooltipStyle::enabled of the theme still describes its widget.
See Accessibility.