Index · Object → Node → CanvasItem → Control → RichTextLabel

RichTextLabel

A control for displaying text that can contain different font styles, images, and basic formatting.

Class Description

A control for displaying text that can contain custom fonts, images, and basic formatting. RichTextLabel manages these as an internal tag stack. It also adapts itself to given width/heights.

Note: newline(), push_paragraph(), "\n", "\r\n", p tag, and alignment tags start a new paragraph. Each paragraph is processed independently, in its own BiDi context. If you want to force line wrapping within paragraph, any other line breaking character can be used, for example, Form Feed (U+000C), Next Line (U+0085), Line Separator (U+2028).

Note: Assignments to text clear the tag stack and reconstruct it from the property's contents. Any edits made to text will erase previous edits made from other manual sources such as append_text() and the push_* / pop() methods.

Note: RichTextLabel doesn't support entangled BBCode tags. For example, instead of using [code skip-lint]boldbold italicitalic[/code], use [code skip-lint]boldbold italicitalic[/code].

Note: push_*/pop_* functions won't affect BBCode.

Note: While bbcode_enabled is enabled, alignment tags such as [code skip-lint][center][/code] will take priority over the horizontal_alignment setting which determines the default text alignment.

Properties

var autowrap_mode: TextServer.AutowrapMode = 3

If set to something other than TextServer.AUTOWRAP_OFF, the text gets wrapped inside the node's bounding rectangle.

Note: RichTextLabels with autowrapping and fit_content enabled must have a custom maximum width configured to work correctly, either through the RichTextLabel's own Control.custom_maximum_size or as a result of a propagated maximum size from a parent Control with Control.propagate_maximum_size enabled.

var autowrap_trim_flags: TextServer.LineBreakFlag = 192

Autowrap space trimming flags. See TextServer.BREAK_TRIM_START_EDGE_SPACES and TextServer.BREAK_TRIM_END_EDGE_SPACES for more info.

var bbcode_enabled: bool = false

If true, the label uses BBCode formatting.

Note: This only affects the contents of text, not the tag stack.

var clip_contents: bool = true
var context_menu_enabled: bool = false

If true, a right-click displays the context menu.

var custom_effects: Array = []

The currently installed custom effects. This is an array of RichTextEffects.

To add a custom effect, it's more convenient to use install_effect().

var deselect_on_focus_loss_enabled: bool = true

If true, the selected text will be deselected when focus is lost.

var drag_and_drop_selection_enabled: bool = true

If true, allow drag and drop of selected text.

var fit_content: bool = false

If true, the label's minimum size will be automatically updated to fit its content, matching the behavior of Label.

Note: RichTextLabels with autowrapping and fit_content enabled must have a custom maximum width configured to work correctly, either through the RichTextLabel's own Control.custom_maximum_size or as a result of a propagated maximum size from a parent Control with Control.propagate_maximum_size enabled.

var focus_mode: Control.FocusMode = 3
var hint_underlined: bool = true

If true, the label underlines hint tags such as [code skip-lint][hint=description]{text}[/hint][/code].

var horizontal_alignment: HorizontalAlignment = 0

Controls the text's horizontal alignment. Supports left, center, right, and fill (also known as justify).

var justification_flags: TextServer.JustificationFlag = 163

Line fill alignment rules.

var language: String = ""

Language code used for line-breaking and text shaping algorithms. If left empty, the current locale is used instead.

var meta_underlined: bool = true

If true, the label underlines meta tags such as [code skip-lint][url]{text}[/url][/code]. These tags can call a function when clicked if meta_clicked is connected to a function.

var progress_bar_delay: int = 1000

The delay after which the loading progress bar is displayed, in milliseconds. Set to -1 to disable progress bar entirely.

Note: Progress bar is displayed only if threaded is enabled.

var scroll_active: bool = true

If true, the scrollbar is visible. Setting this to false does not block scrolling completely. See scroll_to_line().

var scroll_following: bool = false

If true, the window scrolls down to display new content automatically.

var scroll_following_visible_characters: bool = false

If true, the window scrolls to display the last visible line when visible_characters or visible_ratio is changed.

var selection_enabled: bool = false

If true, the label allows text selection.

var shortcut_keys_enabled: bool = true

If true, shortcut keys for context menu items are enabled, even if the context menu is disabled.

var structured_text_bidi_override: TextServer.StructuredTextParser = 0

Set BiDi algorithm override for the structured text.

var structured_text_bidi_override_options: Array = []

Set additional options for BiDi override.

var tab_size: int = 4

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

var tab_stops: PackedFloat32Array = PackedFloat32Array()

Aligns text to the given tab-stops.

var text: String = ""

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.

Note: If bbcode_enabled is true, it is unadvised to use the += operator with text (e.g. text += "some string") as it replaces the whole text and can cause slowdowns. It will also erase all BBCode that was added to stack using push_* methods. Use append_text() for adding text instead, unless you absolutely need to close a tag that was opened in an earlier method call.

var text_direction: Control.TextDirection = 0

Base text writing direction.

var threaded: bool = false

If true, text processing is done in a background thread.

var vertical_alignment: VerticalAlignment = 0

Controls the text's vertical alignment. Supports top, center, bottom, and fill.

var visible_characters: int = -1

The number of characters to display. If set to -1, all characters are displayed. This can be useful when animating the text appearing in a dialog box.

Note: Setting this property updates visible_ratio accordingly.

Note: Characters are counted as Unicode codepoints. A single visible grapheme may contain multiple codepoints (e.g. certain emoji use three codepoints). A single codepoint may contain two UTF-16 characters, which are used in C# strings.

var visible_characters_behavior: TextServer.VisibleCharactersBehavior = 0

The clipping behavior when visible_characters or visible_ratio is set.

var visible_ratio: float = 1.0

The fraction of characters to display, relative to the total number of characters (see get_total_character_count()). If set to 1.0, all characters are displayed. If set to 0.5, only half of the characters will be displayed. This can be useful when animating the text appearing in a dialog box.

Note: Setting this property updates visible_characters accordingly.

Inherited from Control (62)
var accessibility_controls_nodes: NodePath[] = []
var accessibility_flow_to_nodes: NodePath[] = []
var accessibility_labeled_by_nodes: NodePath[] = []
var anchor_bottom: float = 0.0
var anchor_left: float = 0.0
var anchor_right: float = 0.0
var anchor_top: float = 0.0
var clip_contents: bool = false
var custom_maximum_size: Vector2 = Vector2(-1, -1)
var custom_minimum_size: Vector2 = Vector2(0, 0)
var focus_neighbor_bottom: NodePath = NodePath("")
var focus_neighbor_left: NodePath = NodePath("")
var focus_neighbor_right: NodePath = NodePath("")
var focus_neighbor_top: NodePath = NodePath("")
var focus_next: NodePath = NodePath("")
var focus_previous: NodePath = NodePath("")
var offset_bottom: float = 0.0
var offset_left: float = 0.0
var offset_right: float = 0.0
var offset_top: float = 0.0
var offset_transform_pivot: Vector2 = Vector2(0, 0)
var offset_transform_pivot_ratio: Vector2 = Vector2(0.5, 0.5)
var offset_transform_position: Vector2 = Vector2(0, 0)
var offset_transform_scale: Vector2 = Vector2(1, 1)
var pivot_offset: Vector2 = Vector2(0, 0)
var pivot_offset_ratio: Vector2 = Vector2(0, 0)
var position: Vector2 = Vector2(0, 0)
var rotation: float = 0.0
var scale: Vector2 = Vector2(1, 1)
var size: Vector2 = Vector2(0, 0)
Inherited from CanvasItem (16)
var light_mask: int = 1
var modulate: Color = Color(1, 1, 1, 1)
var self_modulate: Color = Color(1, 1, 1, 1)
var top_level: bool = false
var visible: bool = true
var y_sort_enabled: bool = false
var z_as_relative: bool = true
var z_index: int = 0
Inherited from Node (14)
var owner: Node

Methods

func add_hr(width: int = 90, height: int = 2, color: Color = Color(1, 1, 1, 1), alignment: HorizontalAlignment = 1, width_in_percent: bool = true, height_in_percent: bool = false) -> void

Adds a horizontal rule that can be used to separate content.

If width_in_percent is set, width values are percentages of the control width instead of pixels.

If height_in_percent is set, height values are percentages of the control width instead of pixels.

func add_image(image: Texture2D, width: float = 0, height: float = 0, color: Color = Color(1, 1, 1, 1), inline_align: InlineAlignment = 5, region: Rect2 = Rect2(0, 0, 0, 0), key: Variant = null, pad: bool = false, tooltip: String = "", width_unit: RichTextLabel.ImageUnit = 0, height_unit: RichTextLabel.ImageUnit = 0, alt_text: String = "") -> void

Adds an image's opening and closing tags to the tag stack, optionally providing a width and height to resize the image, a color to tint the image and a region to only use parts of the image.

If width or height is set to 0, the image size will be adjusted in order to keep the original aspect ratio.

If width and height are not set, but region is, the region's rect will be used.

key is an optional identifier, that can be used to modify the image via update_image().

If pad is set, and the image is smaller than the size specified by width and height, the image padding is added to match the size instead of upscaling.

Parameters width_unit and height_unit determine the units used to calculate the image width and height, respectively.

alt_text is used as the image description for assistive apps.

func add_text(text: String) -> void

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

func append_text(bbcode: String) -> void

Parses bbcode and adds tags to the tag stack as needed.

Note: Using this method, you can't close a tag that was opened in a previous append_text() call. This is done to improve performance, especially when updating large RichTextLabels since rebuilding the whole BBCode every time would be slower. If you absolutely need to close a tag in a future method call, append the text instead of using append_text().

func clear() -> void

Clears the tag stack, causing the label to display nothing.

Note: This method does not affect text, and its contents will show again if the label is redrawn. However, setting text to an empty String also clears the stack.

func deselect() -> void

Clears the current selection.

func get_character_line(character: int) -> int

Returns the line number of the character position provided. Line and character numbers are both zero-indexed.

Note: If threaded is enabled, this method returns a value for the loaded part of the document. Use is_finished() or finished to determine whether document is fully loaded.

func get_character_paragraph(character: int) -> int

Returns the paragraph number of the character position provided. Paragraph and character numbers are both zero-indexed.

Note: If threaded is enabled, this method returns a value for the loaded part of the document. Use is_finished() or finished to determine whether document is fully loaded.

func get_content_height() -> int

Returns the height of the content.

Note: This method always returns the full content size, and is not affected by visible_ratio and visible_characters. To get the visible content size, use get_visible_content_rect().

Note: If threaded is enabled, this method returns a value for the loaded part of the document. Use is_finished() or finished to determine whether document is fully loaded.

func get_content_width() -> int

Returns the width of the content.

Note: This method always returns the full content size, and is not affected by visible_ratio and visible_characters. To get the visible content size, use get_visible_content_rect().

Note: If threaded is enabled, this method returns a value for the loaded part of the document. Use is_finished() or finished to determine whether document is fully loaded.

func get_line_count() -> int

Returns the total number of lines in the text. Wrapped text is counted as multiple lines.

Note: If threaded is enabled, this method returns a value for the loaded part of the document. Use is_finished() or finished to determine whether document is fully loaded.

func get_line_height(line: int) -> int

Returns the height of the line found at the provided index.

Note: If threaded is enabled, this method returns a value for the loaded part of the document. Use is_finished() or finished to determine whether the document is fully loaded.

func get_line_offset(line: int) -> float

Returns the vertical offset of the line found at the provided index.

Note: If threaded is enabled, this method returns a value for the loaded part of the document. Use is_finished() or finished to determine whether document is fully loaded.

func get_line_range(line: int) -> Vector2i

Returns the indexes of the first and last visible characters for the given line, as a Vector2i.

Note: If visible_characters_behavior is set to TextServer.VC_CHARS_BEFORE_SHAPING only visible wrapped lines are counted.

Note: If threaded is enabled, this method returns a value for the loaded part of the document. Use is_finished() or finished to determine whether document is fully loaded.

func get_line_width(line: int) -> int

Returns the width of the line found at the provided index.

Note: If threaded is enabled, this method returns a value for the loaded part of the document. Use is_finished() or finished to determine whether the document is fully loaded.

func get_menu() -> PopupMenu

Returns the PopupMenu of this RichTextLabel. By default, this menu is displayed when right-clicking on the RichTextLabel.

You can add custom menu items or remove standard ones. Make sure your IDs don't conflict with the standard ones (see MenuItems). For example:

func _ready():
	var menu = get_menu()
	# Remove "Select All" item.
	menu.remove_item(MENU_SELECT_ALL)
	# Add custom items.
	menu.add_separator()
	menu.add_item("Duplicate Text", MENU_MAX + 1)
	# Connect callback.
	menu.id_pressed.connect(_on_item_pressed)

func _on_item_pressed(id):
	if id == MENU_MAX + 1:
		add_text("\n" + get_parsed_text())

Warning: This is a required internal node, removing and freeing it may cause a crash. If you wish to hide it or any of its children, use their Window.visible property.

func get_paragraph_count() -> int

Returns the total number of paragraphs (newlines or p tags in the tag stack's text tags). Considers wrapped text as one paragraph.

func get_paragraph_offset(paragraph: int) -> float

Returns the vertical offset of the paragraph found at the provided index.

Note: If threaded is enabled, this method returns a value for the loaded part of the document. Use is_finished() or finished to determine whether document is fully loaded.

func get_parsed_text() -> String

Returns the text without BBCode mark-up.

func get_selected_text() -> String

Returns the current selection text. Does not include BBCodes.

func get_selection_from() -> int

Returns the current selection first character index if a selection is active, -1 otherwise. Does not include BBCodes.

func get_selection_line_offset() -> float

Returns the current selection vertical line offset if a selection is active, -1.0 otherwise.

func get_selection_to() -> int

Returns the current selection last character index if a selection is active, -1 otherwise. Does not include BBCodes.

func get_total_character_count() -> int

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

func get_v_scroll_bar() -> VScrollBar

Returns the vertical scrollbar.

Warning: This is a required internal node, removing and freeing it may cause a crash. If you wish to hide it or any of its children, use their CanvasItem.visible property.

func get_visible_content_rect() -> Rect2i

Returns the bounding rectangle of the visible content.

Note: This method returns a correct value only after the label has been drawn.

extends RichTextLabel

@export var background_panel: Panel

func _ready():
	await draw
	background_panel.position = get_visible_content_rect().position
	background_panel.size = get_visible_content_rect().size
func get_visible_line_count() -> int

Returns the number of visible lines.

Note: This method returns a correct value only after the label has been drawn.

Note: If threaded is enabled, this method returns a value for the loaded part of the document. Use is_finished() or finished to determine whether document is fully loaded.

func get_visible_paragraph_count() -> int

Returns the number of visible paragraphs. A paragraph is considered visible if at least one of its lines is visible.

Note: This method returns a correct value only after the label has been drawn.

Note: If threaded is enabled, this method returns a value for the loaded part of the document. Use is_finished() or finished to determine whether document is fully loaded.

func install_effect(effect: Variant) -> void

Installs a custom effect. This can also be done in the Inspector through the custom_effects property. effect should be a valid RichTextEffect.

Example: With the following script extending from RichTextEffect:

# effect.gd
class_name MyCustomEffect
extends RichTextEffect

var bbcode = "my_custom_effect"

# ...

The above effect can be installed in RichTextLabel from a script:

# rich_text_label.gd
extends RichTextLabel

func _ready():
	install_effect(MyCustomEffect.new())

	# Alternatively, if not using `class_name` in the script that extends RichTextEffect:
	install_effect(preload("res://effect.gd").new())
func invalidate_paragraph(paragraph: int) -> bool

Invalidates paragraph and all subsequent paragraphs cache.

func is_finished() -> bool

If threaded is enabled, returns true if the background thread has finished text processing, otherwise always return true.

func is_menu_visible() -> bool

Returns whether the menu is visible. Use this instead of get_menu().visible to improve performance (so the creation of the menu is avoided).

func is_ready() -> bool

If threaded is enabled, returns true if the background thread has finished text processing, otherwise always return true.

func menu_option(option: int) -> void

Executes a given action as defined in the MenuItems enum.

func newline() -> void

Adds a newline tag to the tag stack.

func parse_bbcode(bbcode: String) -> void

The assignment version of append_text(). Clears the tag stack and inserts the new content.

func parse_expressions_for_values(expressions: PackedStringArray) -> Dictionary

Parses BBCode parameter expressions into a dictionary.

func pop() -> void

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

func pop_all() -> void

Terminates all tags opened by push_* methods.

func pop_context() -> void

Terminates tags opened after the last push_context() call (including context marker), or all tags if there's no context marker on the stack.

func push_bgcolor(bgcolor: Color) -> void

Adds a [code skip-lint][bgcolor][/code] tag to the tag stack.

Note: The background color has padding applied by default, which is controlled using text_highlight_h_padding and text_highlight_v_padding. This can lead to overlapping highlights if background colors are placed on neighboring lines/columns, so consider setting those theme items to 0 if you want to avoid this.

func push_bold() -> void

Adds a [code skip-lint][font][/code] tag with a bold font to the tag stack. This is the same as adding a [code skip-lint][b][/code] tag if not currently in a [code skip-lint][i][/code] tag.

func push_bold_italics() -> void

Adds a [code skip-lint][font][/code] tag with a bold italics font to the tag stack.

func push_cell() -> void

Adds a [code skip-lint][cell][/code] tag to the tag stack. Must be inside a [code skip-lint][table][/code] tag. See push_table() for details. Use set_table_column_expand() to set column expansion ratio, set_cell_border_color() to set cell border, set_cell_row_background_color() to set cell background, set_cell_size_override() to override cell size, and set_cell_padding() to set padding.

func push_color(color: Color) -> void

Adds a [code skip-lint][color][/code] tag to the tag stack.

func push_context() -> void

Adds a context marker to the tag stack. See pop_context().

func push_customfx(effect: RichTextEffect, env: Dictionary) -> void

Adds a custom effect tag to the tag stack. The effect does not need to be in custom_effects. The environment is directly passed to the effect.

func push_dropcap(string: String, font: Font, size: int, dropcap_margins: Rect2 = Rect2(0, 0, 0, 0), color: Color = Color(1, 1, 1, 1), outline_size: int = 0, outline_color: Color = Color(0, 0, 0, 0)) -> void

Adds a [code skip-lint][dropcap][/code] tag to the tag stack. Drop cap (dropped capital) is a decorative element at the beginning of a paragraph that is larger than the rest of the text.

func push_fgcolor(fgcolor: Color) -> void

Adds a [code skip-lint][fgcolor][/code] tag to the tag stack.

Note: The foreground color has padding applied by default, which is controlled using text_highlight_h_padding and text_highlight_v_padding. This can lead to overlapping highlights if foreground colors are placed on neighboring lines/columns, so consider setting those theme items to 0 if you want to avoid this.

func push_font(font: Font, font_size: int = 0) -> void

Adds a [code skip-lint][font][/code] tag to the tag stack. Overrides default fonts for its duration.

Passing 0 to font_size will use the existing default font size.

func push_font_size(font_size: int) -> void

Adds a [code skip-lint][font_size][/code] tag to the tag stack. Overrides default font size for its duration.

func push_hint(description: String) -> void

Adds a [code skip-lint][hint][/code] tag to the tag stack. Same as BBCode [code skip-lint][hint=something]{text}[/hint][/code].

func push_indent(level: int) -> void

Adds an [code skip-lint][indent][/code] tag to the tag stack. Multiplies level by current tab_size to determine new margin length.

func push_italics() -> void

Adds a [code skip-lint][font][/code] tag with an italics font to the tag stack. This is the same as adding an [code skip-lint][i][/code] tag if not currently in a [code skip-lint][b][/code] tag.

func push_language(language: String) -> void

Adds language code used for text shaping algorithm and Open-Type font features.

func push_list(level: int, type: RichTextLabel.ListType, capitalize: bool, bullet: String = "•") -> void

Adds [code skip-lint][ol][/code] or [code skip-lint][ul][/code] tag to the tag stack. Multiplies level by current tab_size to determine new margin length.

func push_meta(data: Variant, underline_mode: RichTextLabel.MetaUnderline = 1, tooltip: String = "") -> void

Adds a meta tag to the tag stack. Similar to the BBCode [code skip-lint]{text}[/code], but supports non-String metadata types.

If meta_underlined is true, meta tags display an underline. This behavior can be customized with underline_mode.

Note: Meta tags do nothing by default when clicked. To assign behavior when clicked, connect meta_clicked to a function that is called when the meta tag is clicked.

func push_mono() -> void

Adds a [code skip-lint][font][/code] tag with a monospace font to the tag stack.

func push_normal() -> void

Adds a [code skip-lint][font][/code] tag with a normal font to the tag stack.

func push_outline_color(color: Color) -> void

Adds a [code skip-lint][outline_color][/code] tag to the tag stack. Adds text outline for its duration.

func push_outline_size(outline_size: int) -> void

Adds a [code skip-lint][outline_size][/code] tag to the tag stack. Overrides default text outline size for its duration.

func push_paragraph(alignment: HorizontalAlignment, base_direction: Control.TextDirection = 0, language: String = "", st_parser: TextServer.StructuredTextParser = 0, justification_flags: TextServer.JustificationFlag = 163, tab_stops: PackedFloat32Array = PackedFloat32Array()) -> void

Adds a [code skip-lint][p][/code] tag to the tag stack.

func push_strikethrough(color: Color = Color(0, 0, 0, 0)) -> void

Adds a [code skip-lint][s][/code] tag to the tag stack. If color's alpha value is 0.0, the current font's color with its alpha multiplied by strikethrough_alpha is used.

func push_table(columns: int, inline_align: InlineAlignment = 0, align_to_row: int = -1, name: String = "") -> void

Adds a [code skip-lint][table=columns,inline_align][/code] tag to the tag stack. Use set_table_column_expand() to set column expansion ratio. Use push_cell() to add cells. name is used as the table name for assistive apps.

func push_underline(color: Color = Color(0, 0, 0, 0)) -> void

Adds a [code skip-lint][u][/code] tag to the tag stack. If color's alpha value is 0.0, the current font's color with its alpha multiplied by underline_alpha is used.

func reload_effects() -> void

Reloads custom effects. Useful when custom_effects is modified manually.

func remove_paragraph(paragraph: int, no_invalidate: bool = false) -> bool

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

The paragraph argument is the index of the paragraph to remove, it can take values in the interval [0, get_paragraph_count() - 1].

If no_invalidate is set to true, cache for the subsequent paragraphs is not invalidated. Use it for faster updates if deleted paragraph is fully self-contained (have no unclosed tags), or this call is part of the complex edit operation and invalidate_paragraph() will be called at the end of operation.

func scroll_to_line(line: int) -> void

Scrolls the window's top line to match line.

func scroll_to_paragraph(paragraph: int) -> void

Scrolls the window's top line to match first line of the paragraph.

func scroll_to_selection() -> void

Scrolls to the beginning of the current selection.

func select_all() -> void

Select all the text.

If selection_enabled is false, no selection will occur.

func set_cell_border_color(color: Color) -> void

Sets color of a table cell border.

func set_cell_padding(padding: Rect2) -> void

Sets inner padding of a table cell.

func set_cell_row_background_color(odd_row_bg: Color, even_row_bg: Color) -> void

Sets color of a table cell. Separate colors for alternating rows can be specified.

func set_cell_size_override(min_size: Vector2, max_size: Vector2) -> void

Sets minimum and maximum size overrides for a table cell.

func set_table_column_expand(column: int, expand: bool, ratio: int = 1, shrink: bool = true) -> void

Edits the selected column's 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.

If expand is false, the column will not contribute to the total ratio.

func set_table_column_name(column: int, name: String) -> void

Sets table column name for assistive apps.

func update_image(key: Variant, mask: RichTextLabel.ImageUpdateMask, image: Texture2D, width: float = 0, height: float = 0, color: Color = Color(1, 1, 1, 1), inline_align: InlineAlignment = 5, region: Rect2 = Rect2(0, 0, 0, 0), pad: bool = false, tooltip: String = "", width_unit: RichTextLabel.ImageUnit = 0, height_unit: RichTextLabel.ImageUnit = 0) -> void

Updates the existing images with the key key. Only properties specified by mask bits are updated. See add_image().

Inherited from Control (100)
func _can_drop_data(at_position: Vector2, data: Variant) -> bool
func _drop_data(at_position: Vector2, data: Variant) -> void
func _get_cursor_shape(at_position: Vector2) -> int
func _get_drag_data(at_position: Vector2) -> Variant
func _get_tooltip(at_position: Vector2) -> String
func _gui_input(event: InputEvent) -> void
func _has_point(point: Vector2) -> bool
func _structured_text_parser(args: Array, text: String) -> Vector3i[]
func accept_event() -> void
func accessibility_drag() -> void
func accessibility_drop() -> void
func add_theme_color_override(name: StringName, color: Color) -> void
func add_theme_constant_override(name: StringName, constant: int) -> void
func add_theme_font_override(name: StringName, font: Font) -> void
func add_theme_font_size_override(name: StringName, font_size: int) -> void
func add_theme_icon_override(name: StringName, texture: Texture2D) -> void
func add_theme_stylebox_override(name: StringName, stylebox: StyleBox) -> void
func force_drag(data: Variant, preview: Control) -> void
func get_anchor(side: Side) -> float
func get_begin() -> Vector2
func get_cursor_shape(at_position: Vector2 = Vector2(0, 0)) -> Control.CursorShape
func get_end() -> Vector2
func get_focus_neighbor(side: Side) -> NodePath
func get_offset(offset: Side) -> float
func get_rect() -> Rect2
func get_theme_color(name: StringName, theme_type: StringName = &"") -> Color
func get_theme_constant(name: StringName, theme_type: StringName = &"") -> int
func get_theme_font(name: StringName, theme_type: StringName = &"") -> Font
func get_theme_font_size(name: StringName, theme_type: StringName = &"") -> int
func get_theme_icon(name: StringName, theme_type: StringName = &"") -> Texture2D
func get_theme_stylebox(name: StringName, theme_type: StringName = &"") -> StyleBox
func get_tooltip(at_position: Vector2 = Vector2(0, 0)) -> String
func grab_click_focus() -> void
func grab_focus(hide_focus: bool = false) -> void
func has_focus(ignore_hidden_focus: bool = false) -> bool
func has_theme_color(name: StringName, theme_type: StringName = &"") -> bool
func has_theme_constant(name: StringName, theme_type: StringName = &"") -> bool
func has_theme_font(name: StringName, theme_type: StringName = &"") -> bool
func has_theme_font_size(name: StringName, theme_type: StringName = &"") -> bool
func has_theme_icon(name: StringName, theme_type: StringName = &"") -> bool
func has_theme_stylebox(name: StringName, theme_type: StringName = &"") -> bool
func release_focus() -> void
func reset_size() -> void
func set_anchor(side: Side, anchor: float, keep_offset: bool = false, push_opposite_anchor: bool = true) -> void
func set_anchor_and_offset(side: Side, anchor: float, offset: float, push_opposite_anchor: bool = false) -> void
func set_anchors_and_offsets_preset(preset: Control.LayoutPreset, resize_mode: Control.LayoutPresetMode = 0, margin: int = 0) -> void
func set_anchors_preset(preset: Control.LayoutPreset, keep_offsets: bool = false) -> void
func set_begin(position: Vector2) -> void
func set_drag_forwarding(drag_func: Callable, can_drop_func: Callable, drop_func: Callable) -> void
func set_drag_preview(control: Control) -> void
func set_end(position: Vector2) -> void
func set_focus_neighbor(side: Side, neighbor: NodePath) -> void
func set_global_position(position: Vector2, keep_offsets: bool = false) -> void
func set_offset(side: Side, offset: float) -> void
func set_offsets_preset(preset: Control.LayoutPreset, resize_mode: Control.LayoutPresetMode = 0, margin: int = 0) -> void
func set_position(position: Vector2, keep_offsets: bool = false) -> void
func set_size(size: Vector2, keep_offsets: bool = false) -> void
func update_maximum_size() -> void
func update_minimum_size() -> void
func warp_mouse(position: Vector2) -> void
Inherited from CanvasItem (62)
func _draw() -> void
func draw_animation_slice(animation_length: float, slice_begin: float, slice_end: float, offset: float = 0.0) -> void
func draw_arc(center: Vector2, radius: float, start_angle: float, end_angle: float, point_count: int, color: Color, width: float = -1.0, antialiased: bool = false) -> void
func draw_char(font: Font, pos: Vector2, char: String, font_size: int = 16, modulate: Color = Color(1, 1, 1, 1), oversampling: float = 0.0) -> void
func draw_char_outline(font: Font, pos: Vector2, char: String, font_size: int = 16, size: int = -1, modulate: Color = Color(1, 1, 1, 1), oversampling: float = 0.0) -> void
func draw_circle(position: Vector2, radius: float, color: Color, filled: bool = true, width: float = -1.0, antialiased: bool = false) -> void
func draw_colored_polygon(points: PackedVector2Array, color: Color, uvs: PackedVector2Array = PackedVector2Array(), texture: Texture2D = null) -> void
func draw_dashed_line(from: Vector2, to: Vector2, color: Color, width: float = -1.0, dash: float = 2.0, aligned: bool = true, antialiased: bool = false) -> void
func draw_ellipse(position: Vector2, major: float, minor: float, color: Color, filled: bool = true, width: float = -1.0, antialiased: bool = false) -> void
func draw_ellipse_arc(center: Vector2, major: float, minor: float, start_angle: float, end_angle: float, point_count: int, color: Color, width: float = -1.0, antialiased: bool = false) -> void
func draw_end_animation() -> void
func draw_lcd_texture_rect_region(texture: Texture2D, rect: Rect2, src_rect: Rect2, modulate: Color = Color(1, 1, 1, 1)) -> void
func draw_line(from: Vector2, to: Vector2, color: Color, width: float = -1.0, antialiased: bool = false) -> void
func draw_mesh(mesh: Mesh, texture: Texture2D, transform: Transform2D = Transform2D(1, 0, 0, 1, 0, 0), modulate: Color = Color(1, 1, 1, 1)) -> void
func draw_msdf_texture_rect_region(texture: Texture2D, rect: Rect2, src_rect: Rect2, modulate: Color = Color(1, 1, 1, 1), outline: float = 0.0, pixel_range: float = 4.0, scale: float = 1.0) -> void
func draw_multiline(points: PackedVector2Array, color: Color, width: float = -1.0, antialiased: bool = false) -> void
func draw_multiline_colors(points: PackedVector2Array, colors: PackedColorArray, width: float = -1.0, antialiased: bool = false) -> void
func draw_multiline_string(font: Font, pos: Vector2, text: String, alignment: HorizontalAlignment = 0, width: float = -1, font_size: int = 16, max_lines: int = -1, modulate: Color = Color(1, 1, 1, 1), brk_flags: TextServer.LineBreakFlag = 3, justification_flags: TextServer.JustificationFlag = 3, direction: TextServer.Direction = 0, orientation: TextServer.Orientation = 0, oversampling: float = 0.0) -> void
func draw_multiline_string_outline(font: Font, pos: Vector2, text: String, alignment: HorizontalAlignment = 0, width: float = -1, font_size: int = 16, max_lines: int = -1, size: int = 1, modulate: Color = Color(1, 1, 1, 1), brk_flags: TextServer.LineBreakFlag = 3, justification_flags: TextServer.JustificationFlag = 3, direction: TextServer.Direction = 0, orientation: TextServer.Orientation = 0, oversampling: float = 0.0) -> void
func draw_multimesh(multimesh: MultiMesh, texture: Texture2D) -> void
func draw_polygon(points: PackedVector2Array, colors: PackedColorArray, uvs: PackedVector2Array = PackedVector2Array(), texture: Texture2D = null) -> void
func draw_polyline(points: PackedVector2Array, color: Color, width: float = -1.0, antialiased: bool = false) -> void
func draw_polyline_colors(points: PackedVector2Array, colors: PackedColorArray, width: float = -1.0, antialiased: bool = false) -> void
func draw_primitive(points: PackedVector2Array, colors: PackedColorArray, uvs: PackedVector2Array, texture: Texture2D = null) -> void
func draw_rect(rect: Rect2, color: Color, filled: bool = true, width: float = -1.0, antialiased: bool = false) -> void
func draw_set_transform(position: Vector2, rotation: float = 0.0, scale: Vector2 = Vector2(1, 1)) -> void
func draw_string(font: Font, pos: Vector2, text: String, alignment: HorizontalAlignment = 0, width: float = -1, font_size: int = 16, modulate: Color = Color(1, 1, 1, 1), justification_flags: TextServer.JustificationFlag = 3, direction: TextServer.Direction = 0, orientation: TextServer.Orientation = 0, oversampling: float = 0.0) -> void
func draw_string_outline(font: Font, pos: Vector2, text: String, alignment: HorizontalAlignment = 0, width: float = -1, font_size: int = 16, size: int = 1, modulate: Color = Color(1, 1, 1, 1), justification_flags: TextServer.JustificationFlag = 3, direction: TextServer.Direction = 0, orientation: TextServer.Orientation = 0, oversampling: float = 0.0) -> void
func draw_style_box(style_box: StyleBox, rect: Rect2) -> void
func draw_texture(texture: Texture2D, position: Vector2, modulate: Color = Color(1, 1, 1, 1)) -> void
func draw_texture_rect(texture: Texture2D, rect: Rect2, tile: bool, modulate: Color = Color(1, 1, 1, 1), transpose: bool = false) -> void
func draw_texture_rect_region(texture: Texture2D, rect: Rect2, src_rect: Rect2, modulate: Color = Color(1, 1, 1, 1), transpose: bool = false, clip_uv: bool = true) -> void
func force_update_transform() -> void
func get_canvas() -> RID
func hide() -> void
func make_canvas_position_local(viewport_point: Vector2) -> Vector2
func move_to_front() -> void
func queue_redraw() -> void
func set_notify_local_transform(enable: bool) -> void
func set_notify_transform(enable: bool) -> void
func set_visibility_layer_bit(layer: int, enabled: bool) -> void
func show() -> void
Inherited from Node (106)
func _enter_tree() -> void
func _exit_tree() -> void
func _input(event: InputEvent) -> void
func _physics_process(delta: float) -> void
func _process(delta: float) -> void
func _ready() -> void
func _shortcut_input(event: InputEvent) -> void
func _unhandled_input(event: InputEvent) -> void
func _unhandled_key_input(event: InputEvent) -> void
func add_child(node: Node, force_readable_name: bool = false, internal: Node.InternalMode = 0) -> void
func add_sibling(sibling: Node, force_readable_name: bool = false) -> void
func add_to_group(group: StringName, persistent: bool = false) -> void
func atr(message: String, context: StringName = "") -> String
func atr_n(message: String, plural_message: StringName, n: int, context: StringName = "") -> String
func can_process() -> bool
func duplicate(flags: int = 15) -> Node
func find_child(pattern: String, recursive: bool = true, owned: bool = true) -> Node
func find_children(pattern: String, type: String = "", recursive: bool = true, owned: bool = true) -> Node[]
func find_parent(pattern: String) -> Node
func get_child(idx: int, include_internal: bool = false) -> Node
func get_child_count(include_internal: bool = false) -> int
func get_children(include_internal: bool = false) -> Node[]
func get_groups() -> StringName[]
func get_index(include_internal: bool = false) -> int
func get_node(path: NodePath) -> Node
func get_orphan_node_ids() -> int[]
func get_parent() -> Node
func get_path() -> NodePath
func get_path_to(node: Node, use_unique_path: bool = false) -> NodePath
func get_window() -> Window
func has_node(path: NodePath) -> bool
func is_ancestor_of(node: Node) -> bool
func is_greater_than(node: Node) -> bool
func is_in_group(group: StringName) -> bool
func move_child(child_node: Node, to_index: int) -> void
func notify_deferred_thread_group(what: int) -> void
func notify_thread_safe(what: int) -> void
func print_orphan_nodes() -> void
func print_tree() -> void
func print_tree_pretty() -> void
func propagate_call(method: StringName, args: Array = [], parent_first: bool = false) -> void
func propagate_notification(what: int) -> void
func queue_free() -> void
func remove_child(node: Node) -> void
func remove_from_group(group: StringName) -> void
func reparent(new_parent: Node, keep_global_transform: bool = true) -> void
func replace_by(node: Node, keep_groups: bool = false) -> void
func request_ready() -> void
func rpc(method: StringName) -> Error
func rpc_config(method: StringName, config: Variant) -> void
func rpc_id(peer_id: int, method: StringName) -> Error
func set_deferred_thread_group(property: StringName, value: Variant) -> void
func set_display_folded(fold: bool) -> void
func set_editable_instance(node: Node, is_editable: bool) -> void
func set_multiplayer_authority(id: int, recursive: bool = true) -> void
func set_physics_process(enable: bool) -> void
func set_physics_process_internal(enable: bool) -> void
func set_process(enable: bool) -> void
func set_process_input(enable: bool) -> void
func set_process_internal(enable: bool) -> void
func set_process_shortcut_input(enable: bool) -> void
func set_process_unhandled_input(enable: bool) -> void
func set_scene_instance_load_placeholder(load_placeholder: bool) -> void
func set_thread_safe(property: StringName, value: Variant) -> void
Inherited from Object (62)
func _get(property: StringName) -> Variant
func _get_property_list() -> Dictionary[]
func _init() -> void
func _iter_get(iter: Variant) -> Variant
func _iter_init(iter: Array) -> bool
func _iter_next(iter: Array) -> bool
func _notification(what: int) -> void
func _set(property: StringName, value: Variant) -> bool
func _to_string() -> String
func _validate_property(property: Dictionary) -> void
func add_user_signal(signal: String, arguments: Array = []) -> void
func call(method: StringName) -> Variant
func callv(method: StringName, arg_array: Array) -> Variant
func cancel_free() -> void
func connect(signal: StringName, callable: Callable, flags: int = 0) -> Error
func disconnect(signal: StringName, callable: Callable) -> void
func emit_signal(signal: StringName) -> Error
func free() -> void
func get(property: StringName) -> Variant
func get_class() -> String
func get_incoming_connections() -> Dictionary[]
func get_indexed(property_path: NodePath) -> Variant
func get_meta(name: StringName, default: Variant = null) -> Variant
func get_meta_list() -> StringName[]
func get_method_list() -> Dictionary[]
func get_property_list() -> Dictionary[]
func get_signal_connection_list(signal: StringName) -> Dictionary[]
func get_signal_list() -> Dictionary[]
func has_meta(name: StringName) -> bool
func has_method(method: StringName) -> bool
func has_signal(signal: StringName) -> bool
func is_class(class: StringName) -> bool
func is_connected(signal: StringName, callable: Callable) -> bool
func notification(what: int, reversed: bool = false) -> void
func remove_meta(name: StringName) -> void
func remove_user_signal(signal: StringName) -> void
func set(property: StringName, value: Variant) -> void
func set_block_signals(enable: bool) -> void
func set_deferred(property: StringName, value: Variant) -> void
func set_indexed(property_path: NodePath, value: Variant) -> void
func set_message_translation(enable: bool) -> void
func set_meta(name: StringName, value: Variant) -> void
func set_script(script: Variant) -> void
func set_translation_domain(domain: StringName) -> void
func to_string() -> String
func tr(message: StringName, context: StringName = &"") -> String
func tr_n(message: StringName, plural_message: StringName, n: int, context: StringName = &"") -> String

Signals

signal finished()

Triggered when the document is fully loaded.

Note: This can happen before the text is processed for drawing. Scrolling values may not be valid until the document is drawn for the first time after this signal.

signal meta_clicked(meta: Variant)

Triggered when the user clicks on content between meta (URL) tags. If the meta is defined in BBCode, e.g. [code skip-lint]Text[/code], then the parameter for this signal will always be a String type. If a particular type or an object is desired, the push_meta() method must be used to manually insert the data into the tag stack. Alternatively, you can convert the String input to the desired type based on its contents (such as calling JSON.parse() on it).

For example, the following method can be connected to meta_clicked to open clicked URLs using the user's default web browser:

# This assumes RichTextLabel's `meta_clicked` signal was connected to
# the function below using the signal connection dialog.
func _richtextlabel_on_meta_clicked(meta):
	# `meta` is of Variant type, so convert it to a String to avoid script errors at run-time.
	OS.shell_open(str(meta))
signal meta_hover_ended(meta: Variant)

Triggers when the mouse exits a meta tag.

signal meta_hover_started(meta: Variant)

Triggers when the mouse enters a meta tag.

Inherited from Control (10)
signal focus_entered()
signal focus_exited()
signal gui_input(event: InputEvent)
signal mouse_entered()
signal mouse_exited()
signal resized()
signal theme_changed()
Inherited from CanvasItem (4)
signal draw()
signal hidden()
Inherited from Node (11)
signal child_entered_tree(node: Node)
signal child_exiting_tree(node: Node)
signal ready()
signal renamed()
signal replacing_by(node: Node)
signal tree_entered()
signal tree_exited()
signal tree_exiting()
Inherited from Object (2)

Enums & Constants

enum ListType
LIST_NUMBERS = 0

Each list item has a number marker.

LIST_LETTERS = 1

Each list item has a letter marker.

LIST_ROMAN = 2

Each list item has a roman number marker.

LIST_DOTS = 3

Each list item has a filled circle marker.

enum MenuItems
MENU_COPY = 0

Copies the selected text.

MENU_SELECT_ALL = 1

Selects the whole RichTextLabel text.

MENU_MAX = 2

Represents the size of the MenuItems enum.

enum MetaUnderline
META_UNDERLINE_NEVER = 0

Meta tag does not display an underline, even if meta_underlined is true.

META_UNDERLINE_ALWAYS = 1

If meta_underlined is true, meta tag always display an underline.

META_UNDERLINE_ON_HOVER = 2

If meta_underlined is true, meta tag display an underline when the mouse cursor is over it.

enum ImageUpdateMask
UPDATE_TEXTURE = 1

If this bit is set, update_image() changes image texture.

UPDATE_SIZE = 2

If this bit is set, update_image() changes image size.

UPDATE_COLOR = 4

If this bit is set, update_image() changes image color.

UPDATE_ALIGNMENT = 8

If this bit is set, update_image() changes image inline alignment.

UPDATE_REGION = 16

If this bit is set, update_image() changes image texture region.

UPDATE_PAD = 32

If this bit is set, update_image() changes image padding.

UPDATE_TOOLTIP = 64

If this bit is set, update_image() changes image tooltip.

UPDATE_WIDTH_UNIT = 128

If this bit is set, update_image() changes the units used to calculate image size.

enum ImageUnit
IMAGE_UNIT_PIXEL = 0

Images drawn with this unit will be in pixels.

IMAGE_UNIT_PERCENT = 1

Images drawn with this unit will be in percentages of the control width.

IMAGE_UNIT_EM = 2

Images drawn with this unit will be in percentages of the surrounding font size.