HighlightLabel#

class omni.kit.widget.highlight_label.highlight_label.HighlightLabel(
text: str,
highlight: str | None = None,
match_case: bool = False,
width: ~omni.ui._ui.Length = 1.000000fr,
height: ~omni.ui._ui.Length = 1.000000fr,
label_width: int | ~omni.ui._ui.Length = 0,
style: ~typing.Dict | None = None,
**kwargs,
)#

Bases: object

Represents a label widget that can show highlighted words.

Parameters:
  • text (str) – The text content of the label.

  • highlight (Optional[str]) – The word within `text` to be highlighted.

  • match_case (bool) – If `True`, matching is case-sensitive. Defaults to `False`.

  • width (ui.Length) – The width of the widget. Defaults to `ui.Fraction(1)`.

  • height (ui.Length) – The height of the widget. Defaults to `ui.Fraction(1)`.

  • label_width (int) – The width used for ui.Label.

  • style (Dict) – Custom styling for the widget.

Keyword Arguments:
  • alignment (Optional[ui.Alignment]) – Aligns the content within the label. Default is `ui.Alignment.LEFT_CENTER`.

  • name (Optional[str]) – The name of the widget. Used for identifying widgets.

  • style_type_name_override (Optional[str]) – Overrides the default style type name for customization.

Methods

__init__(text[, highlight, match_case, ...])

Initializes the highlight label widget.

Attributes

highlight

Gets the highlight text of the label.

hightlight

Gets the highlight text of the label.

text

Gets the text of the label.

visible

Gets the visibility of the widget.

widget

Gets the widget's container.

__init__(
text: str,
highlight: str | None = None,
match_case: bool = False,
width: ~omni.ui._ui.Length = 1.000000fr,
height: ~omni.ui._ui.Length = 1.000000fr,
label_width: int | ~omni.ui._ui.Length = 0,
style: ~typing.Dict | None = None,
**kwargs,
)#

Initializes the highlight label widget.

property highlight: str | None#

Gets the highlight text of the label.

Returns:

The current highlight text of the label.

Return type:

Optional[str]

property hightlight: str | None#

Gets the highlight text of the label.

Returns:

The current highlight text of the label.

Return type:

Optional[str]

property text: str#

Gets the text of the label.

Returns:

The current text of the label.

Return type:

str

property visible: None#

Gets the visibility of the widget.

property widget: HStack | None#

Gets the widget’s container.