Skip to main content

Text

Properties

PropertyTypeDescription
textstringText displayed
codebooleanUsed for when displaying code
copyableboolean/copyableEnables a copy button to copy displayed text
disabledbooleanWeather the text is disabled
keyboardbooleanAllows user to use keyboard to control
markbooleanWeather the text is highlighted
strongbooleanWeather the text is strong
italicbooleanWeather the text is italic
typesecondary, success, warning, dangerChanges how text is displayed
underlinebooleanWeather the text is underlined
onClickfunction(event)Fired when text is clicked
copyablebooleantable
editablebooleantable
[events]functionPlease read the events page

All properties are optional.

See Icons

Typography.Text

Children

Not supported on paragraph, use text property for setting text.

Example

local Text = Menu:createElement("Text", {
text = "Just a normal ol' text element",
italic = true
})

This is how it looks in-game:

Showcase

copyable

FieldTypeDescription
textstringThe text to copy, leave undefined to copy whats in the text
iconstringIcon displayed that copies the text
tooltipstringTooltip displayed when hovering icon
foramtstring"The Mime Type of the text"
onCopyfunction(event)"The Mime Type of the text"
copyable = {
tooltip = "Click to Copy!",
onCopy = function(id, name, event)
print("User Copied Text!")
end,
}

Copyable

When the icon is pressed the text from the textfield is copied to the user clipboard.

editable

FieldTypeDescription
iconstringIcon displayed to open the editor for the text
tooltipstringTooltip displayed when hovering icon
maxLengthnumberAllowed length of text
autoSizebooleantable
textstringText that is edited, leave blank
enterIconstringIcon displayed for the user to confirm editing
onChangefunction(value)Fired when user changes text input
onStartfunction()Fired when user starts editing
onEndfunction()Fired when user stops editing
onCancelfunction()Fired when user cancels editing
editable = {
tooltip = "Edit",
onChange = function(id, name, value)
text.text = value -- Change text to edited value
print("Edit: OnChange: ", value)
end,
onCancel = function(id, name)
print("Edit: Cancelled Editing")
-- Also fired when `onChange`
end,
onStart = function(id, name)
print("Edit: Started Editing")
end,
onEnd = function(id, name)
print("Edit: Ended Editing")
end,
}

Edit Icon

When Editing