Components / Presentation

Tooltip

Markdown crates/ui/src/tooltip.rs docs.rs

Tooltip

Ask your agent

Install the bezel skill once

npx skills add crabtalk/bezel --skill bezel

Then ask

Give the copy button in my toolbar a "Copy path" tooltip that shows its ⌘C shortcut.
use ui::tooltip::Tooltip;

div()
    .id("copy")
    .tooltip(|window, cx| Tooltip::with_keystroke("Copy path", "⌘C", window, cx))
    .child(copy_icon)
  • The element needs an .id(..).
  • Tooltip::text is the label alone. for_action reads the chord off the keymap and drops it when nothing is bound.
  • The delay is gpui's: .tooltip_show_delay(..) on the element.