Label that displays rich text.
    public class RichTextLabel : Control

Rich text can contain custom text, fonts, images and some basic formatting. The label manages these as an internal tag stack. It also adapts itself to given width/heights.

Note that assignments to BbcodeText clear the tag stack and reconstruct it from the property’s contents. Any edits made to BbcodeText will erase previous edits made from other manual sources such as AppendBbcode(string) and the push_* / Pop() methods.

Inheritance Chain


    public RichTextLabel()


    "meta_clicked" (Nil meta)

Triggered when the user clicks on content between [url] tags. If the meta is defined in text, e.g. [url={"data"="hi"}]hi[/url], then the parameter for this signal will be a String type. If a particular type or an object is desired, the PushMeta(object) method must be used to manually insert the data into the tag stack.

    "meta_hover_ended" (Nil meta)

Triggers when the mouse exits a meta tag.

    "meta_hover_started" (Nil meta)

Triggers when the mouse enters a meta tag.


    public bool BbcodeEnabled { get; set; }

If true the label uses BBCode formatting. Default value: false.

    public string BbcodeText { get; set; }

The label’s text in BBCode format. Is not representative of manual modifications to the internal tag stack. Erases changes made by other methods when edited.

    public bool MetaUnderlined { get; set; }

If true, the label underlines meta tags such as {text}. Default value: true.

    public bool OverrideSelectedFontColor { get; set; }

If true the label uses the custom font color. Default value: false.

    public float PercentVisible { get; set; }

The text’s visibility, as a [float](] between 0.0 and 1.0.

    public bool ScrollActive { get; set; }

If true, the scrollbar is visible. Does not block scrolling completely. See ScrollToLine(int). Default value: true.

    public bool ScrollFollowing { get; set; }

If true, the window scrolls down to display new content automatically. Default value: false.

    public bool SelectionEnabled { get; set; }

If true, the label allows text selection.

    public int TabSize { get; set; }

The number of spaces associated with a single tab length. Does not affect “\t” in text tags, only indent tags.

    public string Text { get; set; }

The raw text of the label.

When set, clears the tag stack and adds a raw text tag to the top of it. Does not parse bbcodes. Does not modify BbcodeText.

    public int VisibleCharacters { get; set; }

The restricted number of characters to display in the label.


    public void AddImage(Texture image)

Adds an image’s opening and closing tags to the tag stack.

    public void AddText(string text)

Adds raw non-bbcode-parsed text to the tag stack.

    public Error AppendBbcode(string bbcode)

Parses bbcode and adds tags to the tag stack as needed. Returns the result of the parsing, OK if successful.

    public void Clear()

Clears the tag stack and sets BbcodeText to an empty string.

    public string GetBbcode()

Getter for BbcodeText

    public int GetLineCount()

Returns the total number of newlines in the tag stack’s text tags. Considers wrapped text as one line.

    public float GetPercentVisible()

Getter for PercentVisible

    public int GetTabSize()

Getter for TabSize

    public string GetText()

Getter for ItemType.Text

    public int GetTotalCharacterCount()

Returns the total number of characters from text tags. Does not include bbcodes.

    public int GetVisibleCharacters()

Getter for VisibleCharacters

    public int GetVisibleLineCount()

Returns the number of visible lines.

    public VScrollBar GetVScroll()

Returns the vertical scrollbar.

    public bool IsMetaUnderlined()

Getter for MetaUnderlined

    public bool IsOverridingSelectedFontColor()

Getter for OverrideSelectedFontColor

    public bool IsScrollActive()

Getter for ScrollActive

    public bool IsScrollFollowing()

Getter for ScrollFollowing

    public bool IsSelectionEnabled()

Getter for SelectionEnabled

    public bool IsUsingBbcode()

Getter for BbcodeEnabled

    public void Newline()

Adds a newline tag to the tag stack.

    public Error ParseBbcode(string bbcode)

The assignment version of AppendBbcode(string). Clears the tag stack and inserts the new content. Returns OK if parses bbcode successfully.

    public void Pop()

Terminates the current tag. Use after push_* methods to close bbcodes manually. Does not need to follow add_* methods.

    public void PushAlign(Align align)

Adds a [right] tag to the tag stack.

    public void PushCell()

Adds a [cell] tag to the tag stack. Must be inside a [table] tag. See PushTable(int) for details.

    public void PushColor(Color color)

Adds a color tag to the tag stack.

    public void PushFont(Font font)

Adds a font tag to the tag stack. Overrides default fonts for its duration.

    public void PushIndent(int level)

Adds an [indent] tag to the tag stack. Multiplies “level” by current tab_size to determine new margin length.

    public void PushList(ListType type)

Adds a list tag to the tag stack. Similar to the bbcodes [ol] or [ul], but supports more list types. Not fully implemented!

    public void PushMeta(object data)

Adds a meta tag to the tag stack. Similar to the bbcode [url=something]{text}[/url], but supports non-String metadata types.

    public void PushTable(int columns)

Adds a [table=columns] tag to the tag stack.

    public void PushUnderline()

Adds a [u] tag to the tag stack.

    public bool RemoveLine(int line)

Removes a line of content from the label. Returns true if the line exists.

    public void ScrollToLine(int line)

Scrolls the window’s top line to match line.

    public void SetBbcode(string text)

Setter for BbcodeText

    public void SetMetaUnderline(bool enable)

Setter for MetaUnderlined

    public void SetOverrideSelectedFontColor(bool @override)

Setter for OverrideSelectedFontColor

    public void SetPercentVisible(float percentVisible)

Setter for PercentVisible

    public void SetScrollActive(bool active)

Setter for ScrollActive

    public void SetScrollFollow(bool follow)

Setter for ScrollFollowing

    public void SetSelectionEnabled(bool enabled)

Setter for SelectionEnabled

    public void SetTableColumnExpand(int column, bool expand, int ratio)

Edits the selected columns expansion options. If expand is true, the column expands in proportion to its expansion ratio versus the other columns’ ratios.

For example, 2 columns with ratios 3 and 4 plus 70 pixels in available width would expand 30 and 40 pixels, respectively.

Columns with a false expand will not contribute to the total ratio.

    public void SetTabSize(int spaces)

Setter for TabSize

    public void SetText(string text)

Setter for ItemType.Text

    public void SetUseBbcode(bool enable)

Setter for BbcodeEnabled

    public void SetVisibleCharacters(int amount)

Setter for VisibleCharacters

Inner Types


Name Value Description
Left 0  
Center 1  
Right 2  
Fill 3  


Name Value Description
Frame 0  
Text 1  
Image 2  
Newline 3  
Font 4  
Color 5  
Underline 6  
Align 7  
Indent 8  
List 9  
Table 10  
Meta 11  


Name Value Description
Numbers 0  
Letters 1  
Dots 2