Incular logoIncular
API ReferenceInput & Forms

RawTooltip

Retained unthemed tooltip with state-machine controller and durations.

RawTooltip is the retained unthemed tooltip descriptor (child + semantics + anchored overlay). RawTooltipController is shared imperative state polled via poll/tick — no timer threads.

use incular::prelude::*;

fn main() {
    let controller = RawTooltipController::new();
    controller.show();
    assert!(controller.is_visible());
    controller.hide();
    let app = Application::new(move |_cx| {
        Container::builder()
            .padding(EdgeInsets::all(24.0))
            .alignment(Alignment::CENTER)
            .child(
                RawTooltip::new("Save", Text::new("Hover me"))
                    .controller(controller.clone())
                    .trigger_mode(RawTooltipTriggerMode::Hover)
                    .prefer_below(true)
                    .vertical_offset(14.0)
                    .enable_tap_to_dismiss(true)
                    .on_triggered(|| println!("triggered")),
            )
            .build()
            .into()
    })
    .expect("valid application");
    incular::run(app).expect("run application");
}

Controller: show() / hide() / toggle() / show_for(dur, now) / trigger_tap() / mouse_enter(device) / focus_changed(b) / tick(now) / poll() / dismiss_all() / state() / is_visible().

RawTooltipTriggerMode: Manual / Tap / LongPress (default) / Focus / Hover (TooltipTriggerMode is the same type; TooltipVisibility aliases RawTooltipVisibility: Hidden default / Waiting / Visible / Dismissing). RawTooltipDurations { wait, show, exit } defaults: wait zero, show 1500ms, exit 100ms (TooltipDurations alias). TooltipComponentBuilder::new(|| widget) builds rich content (RawTooltipBuilder alias); with_builder / content attach it.

Related: Tooltip, OverlayPortal.