Expand description
Tooltip properties and widget.
The tooltip and tooltip_fn properties can be set on any widget to git it a tooltip.
The tooltip itself can also be any widget, but the Tip! widget is recommended. You can also set a tooltip
that only appears when the widget is disabled using disabled_tooltip.
The example below declares a button that toggles enabled showing different tooltips depending on the state.
use zng::prelude::*;
let enabled = var(true);
Button! {
tip::tooltip = Tip!(Text!("enabled tooltip"));
tip::disabled_tooltip = Tip!(Text!("disabled tooltip"));
on_click = hn!(enabled, |_| enabled.set(false));
gesture::on_disabled_click = hn!(enabled, |_| enabled.set(true));
child = Text!(enabled.map(|&e| formatx!("enabled = {e}")));
widget::enabled;
}§Full API
See zng_wgt_tooltip for the full tooltip API.
Structs§
- Default
Style WTip default style.- Tip
WA tooltip popup.- Tooltip
Args - Arguments for tooltip widget functions.
Functions§
- access_
tooltip_ anchor PSet the position of the tip widgets opened for the widget or its descendants without cursor interaction.- access_
tooltip_ duration PSets the maximum duration a tooltip stays open on the widget or descendants when it is opened without cursor interaction.- disabled_
tooltip PDisabled widget tooltip.- disabled_
tooltip_ fn PDisabled widget tooltip.- style_
fn PExtends or replaces the widget style.- tooltip
PWidget tooltip.- tooltip_
anchor PSet the position of the tip widgets opened for the widget or its descendants.- tooltip_
context_ capture PDefines if the tooltip captures the build/instantiate context and sets it in the node context.- tooltip_
delay PSet the duration the cursor must be over the widget or its descendants before the tip widget is opened.- tooltip_
duration PSets the maximum duration a tooltip stays open on the widget or descendants.- tooltip_
fn PWidget tooltip set as a widget function that is called every time the tooltip must be shown.- tooltip_
interval PSets the maximum interval a second tooltip is opened instantly if a previous tip was just closed.