Label

Label UI component, extends UIComponent class. Label can be used to display plain text, HTML content, and image as an icon.

For more methods for this component check UIComponent class.

Constructor

new Label(textopt)

Label constructor.

Parameters:
NameTypeAttributesDescription
textstring<optional>

Initial text to display in the label.

Example
<h2>Few ways to create and use Label:</h2>
// Setting text in constructor
const label1 = new Label("New label text");

// Setting text after instantiation
const label2 = new Label().text("Second label text");

// setting an image icon
const label2 = new Label().icon("images/icon.png");

// setting HTML content to be rendered in the label component
const label2 = new Label("<html><body><h1>Label Header</h1><p>New paragraph</p></body></html>");

Classes

Label

Members

iconSize :Object|undefined

Returns current size of an icon, or undefined when no icon has been set or icon failed to load.

Type:
  • Object | undefined