Tooltip
Hover-activated floating information bubble displaying helper text, rich layout, and delay timers.
Overview
Tooltip displays a floating helper box containing contextual information when a user hovers over an interactive UI element.
Key features: - Plain text and RichText formatted layout. - Automatic boundary detection to keep tooltip content within screen bounds. - Show and hide delay thresholds to prevent accidental flickering. - Customizable background, border, text color, and padding.
Attaching Tooltip to Widget
Related links
- OverlayLayer: Full-screen overlay root managing modal backdrops, dialogs, popups, and layer-based hit testing.
- Popup: Anchored floating popup widget that positions itself relative to target widgets or screen coordinates.
API
Tooltip()
Constructs an empty Tooltip.
Tooltip(Widget, RichText)
Constructs a Tooltip anchored to a widget with RichText.
| Parameter | Type | Description |
|---|---|---|
anchor |
Widget |
Anchor widget to position relative to. |
text |
RichText |
RichText formatted text component. |
Tooltip(Widget, String)
Constructs a Tooltip anchored to a widget with plain text.
| Parameter | Type | Description |
|---|---|---|
anchor |
Widget |
Anchor widget to position relative to. |
text |
String |
Display text string. |
Tooltip::anchor()
Returns the anchor widget this tooltip observes.
Returns Widget: The target anchor widget..
Tooltip::anchor(Widget)
Sets the anchor widget this tooltip observes.
| Parameter | Type | Description |
|---|---|---|
anchor |
Widget |
Anchor widget to position relative to. |
Returns Tooltip: This widget instance for chaining..
Tooltip::arrangeInHost(RectView)
Clamps and positions the tooltip relative to pointer within host bounds.
| Parameter | Type | Description |
|---|---|---|
bounds |
RectView |
Available host rectangular boundary. |
Tooltip::maxWidth()
Returns the maximum tooltip wrap width.
Returns float: Maximum range bound..
Tooltip::maxWidth(float)
Sets the maximum tooltip wrap width.
| Parameter | Type | Description |
|---|---|---|
maxWidth |
float |
Maximum width constraint. |
Returns Tooltip: This widget instance for chaining..
Tooltip::offset(float, float)
Sets cursor displacement offset in UI pixels.
| Parameter | Type | Description |
|---|---|---|
x |
float |
Horizontal X coordinate. |
y |
float |
Vertical Y coordinate. |
Returns Tooltip: This widget instance for chaining..
Tooltip::richText()
Returns the formatted RichText content.
Returns RichText: The RichText formatted content..
Tooltip::richText(RichText)
Sets the formatted RichText content.
| Parameter | Type | Description |
|---|---|---|
richText |
RichText |
RichText formatted text component. |
Returns Tooltip: This widget instance for chaining..
Tooltip::showing()
Returns true if the tooltip is currently visible.
Returns boolean: True if currently visible..
Tooltip::text()
Returns the tooltip plain text.
Returns String: The displayed text string..
Tooltip::text(String)
Sets the tooltip plain text.
| Parameter | Type | Description |
|---|---|---|
text |
String |
Display text string. |
Returns Tooltip: This widget instance for chaining..
Tooltip::textColor()
Returns the mutable text foreground color.
Returns MutableColor: The mutable color instance..