Roots Docs

Labels

Label is the only element shipped with Rish. It’s a foundational VisualElement. It inherits from UnityEngine.UIElements.Label.

A string or RishString can be implicitly converted into an Element. So, similarly to HTML, you can treat text as a UI Element.

HTML
<div class="container">Hello, world.</div>
C# Rish
Div.Create(className: "container", children: "Hello, world.");

We recommend creating wrappers for different label styles (like Body, H1, H2…).

Inputs

  • RishString text: The text to render.
  • LengthRange? widthRange: Optional width size range. If set, UI Toolkit will use for the reported preferred size in the layouting phase.
  • LengthRange? heightRange: Optional height size range. If set, UI Toolkit will use for the reported preferred size in the layouting phase.
  • bool? enableRichText: Whether or not rich text tags get parsed or not.
  • bool? parseEscapeSequences: Wheter or not escape sequences get parsed or not.
  • Action<bool> onElided: Callback that reports when the text is ellided or not.