Skip to main content

TooltipExt

Trait TooltipExt 

Source
pub trait TooltipExt: StatefulInteractiveElement + Sized {
    // Required method
    fn managed_tooltip_with(
        self,
        placement: Option<Placement>,
        build: impl Fn(&mut App) -> AnyView + 'static,
        window: &Window,
        cx: &App,
    ) -> Self;

    // Provided methods
    fn managed_tooltip(
        self,
        text: impl Into<SharedString>,
        window: &Window,
        cx: &App,
    ) -> Self { ... }
    fn managed_tooltip_at(
        self,
        placement: Placement,
        text: impl Into<SharedString>,
        window: &Window,
        cx: &App,
    ) -> Self { ... }
}
Expand description

Gives a stateful element a managed tooltip.

The tooltip shows through the window’s registered base overlay (see TooltipHost) after the overlay’s delay, follows the trigger’s bounds, hides on press, and is suppressed on iOS and Android by base. In a window with no registered overlay the element gets GPUI’s native tooltip instead, so the text is never lost. The window decides which, so the methods take it.

The managed tooltip installs the element’s hover listener. An element that sets on_hover itself uses TooltipTrigger directly instead, as gpui-cn components do.

Required Methods§

Source

fn managed_tooltip_with( self, placement: Option<Placement>, build: impl Fn(&mut App) -> AnyView + 'static, window: &Window, cx: &App, ) -> Self

A tooltip with an arbitrary view.

Provided Methods§

Source

fn managed_tooltip( self, text: impl Into<SharedString>, window: &Window, cx: &App, ) -> Self

A text tooltip.

Source

fn managed_tooltip_at( self, placement: Placement, text: impl Into<SharedString>, window: &Window, cx: &App, ) -> Self

A text tooltip that prefers placement, falling back when it does not fit.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§