TextLabel
Up and coming: shot check knows this class and its members today, and programs run it once the native runtime lands.
Up and coming
Text with coloured spans and pictures inline, sized to about two thirds of its box, that wraps, cuts off neatly and can be selected and copied.
A line takes 65% of the box's height by default (TextFill); set TextSize for wrapped paragraphs instead. With Markup on, a tagged span takes its look from Styles and [Name] shows a picture from Images; with it off, text is drawn exactly as written, so a < or [ in it stays as typed. MeasureAsync lays text out without drawing it, for scripted layout.
Made with Instance.new("TextLabel") or Clone().
Properties
| Name | Type | Default | Description |
|---|---|---|---|
| Text | string | What the label shows; with Markup on, it can hold tagged spans and [Name] pictures. | |
| Markup | boolean | True: tagged spans take their look from Styles and [Name] placeholders a picture from Images; false: drawn exactly as written. | |
| Styles | { [string]: TextStyle } | Named styles for markup spans; each is a Color, with an optional Font and Transparency. | |
| Images | { [string]: Icon } | Pictures that fill the [Name] placeholders; an amount is its picture then the number, as in [Coins]250. | |
| Font | Font | Font.UI, Font.UISemibold, Font.Mono or Font.fromFile(path); Japanese, emoji and symbols fall back to the Windows fonts. | |
| TextColor | Color3 | ||
| TextTransparency | number | ||
| TextFill | number | One line's height as a fraction of the box's height, 0.65 by default. | |
| TextSize | number? | In logical pixels; set it for wrapped paragraphs, where TextFill no longer applies. | |
| LineSpacing | number | 1.25 by default. | |
| TextWrapped | boolean | ||
| TextTruncate | "None" | "End" | "Middle" | One "..." where the text is cut, and Middle keeps both ends of a path; a cut label shows its full text as the tooltip. | |
| TextXAlignment | "Left" | "Center" | "Right" | ||
| TextYAlignment | "Top" | "Center" | "Bottom" | ||
| Selectable | boolean | Dragging selects the text and Ctrl+C copies it, for things like an error message. | |
| TextBounds | Vector2 | read-only | The laid-out text's size, known once the text has been drawn. |
Methods
| Name | Arguments | Returns | Description |
|---|---|---|---|
| MeasureAsync yields | (text: string, width: number?) | Vector2 | Lays text out in this label's font without drawing it and waits for the size, for scripted layout. |
From UIObject 19
From ScreenItem 2
From ShotInstance 33
ClassNameNameParentAncestryChangedAttributeChangedChangedChildAddedChildRemovedDestroyingAddTagClearAllChildrenCloneDestroyFindFirstAncestorFindFirstAncestorOfClassFindFirstAncestorWhichIsAFindFirstChildFindFirstChildOfClassFindFirstChildWhichIsAGetAttributeGetAttributeChangedSignalGetAttributesGetChildrenGetDescendantsGetFullNameGetPropertyChangedSignalGetTagsHasTagIsAIsAncestorOfIsDescendantOfRemoveTagSetAttribute
Subclasses
