docs v1.0.0

Tooltip

Returns BoxNamespace Bibui.Core.RuntimeSourceTheme tokens

One line of small text on a dark pill, centred above a box you hold, or placed by the mouse. It is built into the runtime's tooltip root, so it is drawn over everything and takes nothing: the pointer goes through it.

Preview
Verified render
tooltip-above
tooltip-above

Fixture: tooltip-above.

Build

C#
public static Box Build(BibuiRuntime runtime, ReadOnlySpan<char> text, Box? anchor = null)
ParameterMeaning
textWhat it reads.
anchorThe box it sits above, 8 px clear and centred, where it was drawn last frame. With no anchor, it sits by the mouse at runtime.DefaultToolTipOffset.

Claims and reports

None. It returns the pill's Box.

State the caller owns

When to show it. It decides nothing: build it in a frame you want it, usually while the trigger reports Hovering.

Theme tokens

  • Pill: a TextPrimary fill and the runtime.Theme.Elevation tooltip shadow.
  • Text: Background, at the small size. The pill inverts the page's colours.

Example

C#
using Bibui.Core;
using Bibui.Core.Runtime;

sealed class CopyButton
{
    const string Copy = "Copy";
    const string Tip = "Copy to clipboard";

    public UiNode Build(BibuiRuntime runtime)
    {
        var copy = runtime.Button("copy", Copy, ghost: true);
        if (copy.Hovering) Tooltip.Build(runtime, Tip, (Box)copy.Node);
        if (copy.Clicked) runtime.ClipboardSet("copied text");
        return copy;
    }
}