LogoObsidian

Label

Labels are used to display text.

Playground

[Obsidian] every text component (ex: Notification Title, Descriptions, etc.) supports Rich Text by default!

Usage

You can create a Label by calling the AddLabel method on a Groupbox.

Choose between positional arguments for quick calls or a configuration table for more readability.

Positional Arguments

local Label = Groupbox:AddLabel("This is a label", false)
Arg IdxArgument DescriptionTypeDefault
1Text of the labelstringnil
2Whether to wrap the textbooleantrue

or

Configuration Table

local LabelOptions = {
    Text = "This is a label",
    DoesWrap = false
}
 
local Label = Groupbox:AddLabel(LabelOptions)
-- or local Label = Groupbox:AddLabel("MyLabel", LabelOptions)
-- which allows you to do: Options.MyLabel:SetText("This is a label")

Prop

Type

Methods

You can use the following methods to interact with the label:

SetText

Sets the text of the label.

Label:SetText(text)
Arg IdxArgument DescriptionTypeDefault
1Text of the labelstringnil

SetSize

Sets the size of the label.

Label:SetSize(size)
Arg IdxArgument DescriptionTypeDefault
1Size of the labelnumbernil

SetVisible

Shows or hides the label.

Label:SetVisible(boolean)
Arg IdxArgument DescriptionTypeDefault
1Whether to show the labelbooleannil

On this page