class Label

Extends:
UIComponent

Description:

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

constructor([text])

Label constructor.

Parameters:

Name Type Description

[text]

string

Initial text to display in the label.

Members

Methods

Inherited from UIComponent:

Examples:

Few ways to create and use Label:

// 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>");