TooltipExt

Trait TooltipExt 

Source
pub trait TooltipExt {
    // Required method
    fn tooltip<V: IntoView + 'static>(
        self,
        tip: impl Fn() -> V + 'static,
    ) -> Tooltip;
}
Expand description

Adds a tooltip function to a type that implements IntoView.

Required Methods§

Source

fn tooltip<V: IntoView + 'static>( self, tip: impl Fn() -> V + 'static, ) -> Tooltip

Adds a tooltip to the view.

§Examples
// Simple usage:
let simple = text("A text with tooltip")
    .tooltip(|| "This is a tooltip.");
// More complex usage:
let mut click_counter = RwSignal::new(0);
let complex = text("A text with a tooltip that changes on click")
    .on_click_stop(move|_| click_counter += 1)
    .tooltip(move || format!("Clicked {} times on the label", click_counter.get()));
§Reactivity

This function is not reactive, but it is computing its result on every tooltip trigger. It is possible then to have different tooltip output, but the output it will not change once while displaying a hover.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<T: IntoView + 'static> TooltipExt for T