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 |
|---|---|---|
|
|
string |
Initial text to display in the label. |
Members
- [ readonly ] container
- iconSize
- [ readonly ] id
- [ readonly ] parent
- [ readonly ] screenPosition
Methods
Inherited from UIComponent:
- addTo()
- alignment()
- anchor()
- background()
- border()
- bottom()
- center()
- color()
- contextMenu()
- cursor()
- destroy()
- dragAction()
- dragData()
- dragDataType()
- dropAction()
- dropDataType()
- dropMode()
- emit()
- emitFocusKeyEvents()
- enabled()
- focusable()
- focused()
- font()
- getAncestor()
- getWindow()
- height()
- hide()
- icon()
- iconAlignment()
- iconTextGap()
- index()
- isInside()
- layer()
- maxIconSize()
- maxSize()
- minIconSize()
- minSize()
- move()
- onAncestorEvents()
- onComponentEvents()
- onDispose()
- onDragEvents()
- onDropEvents()
- onError()
- onFocusEvents()
- onKey()
- onMouseEvents()
- onMouseMotion()
- onMouseWheel()
- onPropertyChange()
- opacity()
- position()
- remove()
- right()
- size()
- snapshot()
- text()
- tooltip()
- updateUI()
- verifyComponent()
- visible()
- width()
- x()
- y()
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>");
