1.3 KiB
1.3 KiB
Label : VisualElement
This is the label class. It provides a simple text display element that automatically resizes its width based on the text content.
Properties
| Property | Type | Default | Description |
|---|---|---|---|
| text | string | Label | The text content to display. Can be a string or a function that returns a string |
| autoSize | boolean | true | Whether the label should automatically resize its width based on the text content |
Functions
| Method | Returns | Description |
|---|---|---|
| Label.new | Label | Creates a new Label instance |
| Label:getWrappedText | table | Gets the wrapped lines of the Label |
| Label:init | Label | Initializes the Label instance |
| Label:render | - | Renders the Label by drawing its text content |
Label.new()
Creates a new Label instance
Returns
LabelselfThe newly created Label instance
Usage
local label = Label.new()
Label:getWrappedText()
Gets the wrapped lines of the Label
Returns
tablewrappedTextThe wrapped lines of the Label
Label:init(props, basalt)
Initializes the Label instance
Parameters
propstableThe properties to initialize the element withbasalttableThe basalt instance
Returns
LabelselfThe initialized instance
Label:render()
Renders the Label