UI Toolbox logoUI Toolbox
Support

Tooltips

Only Editor panels show the tooltip text of an element. In a runtime panel, the workspace shows it:

A ToolTip with a bold Fireball header, rich text damage and cooldown, and an arrow pointing at a Fireball buttonA ToolTip with a bold Fireball header, rich text damage and cooldown, and an arrow pointing at a Fireball button

<ui:Button
    text="Save"
    tooltip="Saves the layout. &lt;b&gt;Ctrl+S&lt;/b&gt;" />

ToolTip

A ToolTip adds a header, its own delay, and a place next to its target with an arrow:

<ui:Button name="target-button" text="Save" />
<tb:ToolTip
    target="target-button"
    title="Save"
    description="Saves the layout. &lt;b&gt;Ctrl+S&lt;/b&gt;"
    show-delay="300"
    placement="Below" />
var tip = new ToolTip
{
    Title = "Save",
    Description = "Saves the layout.",
    Placement = TooltipPlacement.Right
};
tip.AttachTo(saveButton);
Attribute Property Default Description
target TargetName empty The name of the target. The element looks for it under its parent, then under each ancestor in turn, when it attaches to a panel.
title Title empty A bold first line. Empty shows no header.
description Description empty The rich text. The element puts it in the target's tooltip, so an Editor panel still shows it.
show-delay ShowDelayMs -1 Milliseconds before the tooltip shows. A negative value uses the workspace tooltip-delay.
hide-delay HideDelayMs 0 Milliseconds the tooltip stays after the pointer leaves the target. If the pointer comes back in that time, the tooltip stays. The next tooltip waits for the hide. 0 hides at once.
placement Placement Pointer Pointer shows it near the pointer with no arrow. Below, Above, Right and Left center it on that side of the target, with an arrow that points at the target center. It flips to the other side when that side has no room.
tooltip-class TooltipClass empty USS classes, with a space between them, that the tooltip has while it shows for this target. See Colors and your own look.

Colors and your own look

The workspace has one tooltip for all targets. tooltip-class puts classes on it for one target only:

<tb:ToolTip
    target="delete-button"
    title="Delete"
    description="You cannot undo this."
    placement="Below"
    tooltip-class="tb-tooltip--error" />
Class Constant Colors
tb-tooltip--accent ToolTip.ACCENT_CLASS --tb-color-accent with --tb-color-accent-text
tb-tooltip--success ToolTip.SUCCESS_CLASS --tb-color-success with --tb-color-background
tb-tooltip--warning ToolTip.WARNING_CLASS --tb-color-warning with --tb-color-background
tb-tooltip--error ToolTip.ERROR_CLASS --tb-color-danger with --tb-color-danger-text

For your own look, name a class of your style sheet. Color the arrow with the box, and set the text color on the labels:

.tb-tooltip.my-tooltip,
.tb-tooltip.my-tooltip > .tb-tooltip__arrow {
    background-color: rgb(46, 16, 74);
    border-color: rgb(255, 121, 198);
}
.tb-tooltip.my-tooltip { border-radius: 12px; font-size: 14px; }
.tb-tooltip.my-tooltip > Label { color: rgb(255, 214, 240); }

The style sheet must be on the workspace or on an element above it, because the tooltip is a child of the workspace.

Styling

Class Element
tb-tooltip The workspace tooltip (absolute, max 320 px wide, opacity 0 until shown).
tb-tooltip--shown Added when the tooltip shows (opacity 1).
tb-tooltip--anim-fade Transition class for the fade in (opacity, --tb-animation-duration-fast).
tb-tooltip__header, tb-tooltip__body The bold header (hidden when empty) and the rich text.
tb-tooltip__arrow A 10 px square turned 45 degrees, with the tooltip background. Hidden near the pointer.
tb-tooltip--below, --above, --right, --left The side of the target, after a flip. Each puts the arrow on the facing edge and shows the two borders that face out.

The ToolTipDemo scene shows plain tooltip text on the buttons of a pause menu, a header and rich text above each skill of a hotbar, item stats whose tooltips wait for the pointer to come back, settings that explain themselves to the keys and a gamepad, and seven looks of the tooltips of a treasure chest.