Skip to content

Component Tooltip

MeowLynxSea edited this page Jan 24, 2026 · 4 revisions

Tooltip

A tooltip view builder.

Tooltips in Yororen UI are built as views. The common pattern is:

  1. Create a tooltip builder via tooltip("...")
  2. Call .build() to obtain a view factory
  3. Attach it to an interactive element that supports .tooltip(...) (for example ClickableSurface)

When to use

  • Clarifying icon-only actions (e.g. close buttons)
  • Explaining non-obvious controls

Not a good fit:

  • Critical or persistent information (use inline Label or help text)

Example

use yororen_ui::component::{clickable_surface, tooltip};

let view = clickable_surface()
    .child("Hover me")
    .tooltip(tooltip("Hello").build());

API

  • tooltip("...") / Tooltip::text("..."): constructor
  • placement(TooltipPlacement): placement hint (Auto, Top, Right, Bottom, Left)
  • bg(Hsla) / text_color(Hsla)
  • build() -> impl Fn(&mut Window, &mut App) -> AnyView: create a view factory

Notes

  • Tooltip rendering/triggering is handled by the host element/GPUI; this type just defines the view.

Defaults

  • Placement: TooltipPlacement::Auto
  • Background: theme.action.neutral.bg
  • Text color: theme.action.neutral.fg

Example: Placement + custom colors

use gpui::rgb;
use yororen_ui::component::{TooltipPlacement, clickable_surface, tooltip};

let view = clickable_surface()
    .child("Hover")
    .tooltip(
        tooltip("Pinned to top")
            .placement(TooltipPlacement::Top)
            .bg(rgb(0x121214))
            .text_color(rgb(0xFFFFFF))
            .build(),
    );

Clone this wiki locally