Inheritance #

LinkButton
Table of contents

LinkButton #

is_instantiable, Node, core, not_builtin_classes

A button that represents a link.

A button that represents a link. This type of button is primarily used for interactions that cause a context change (like linking to a web page).

See also BaseButton which contains common properties and methods associated with this node.

Members #

var focus_mode = FOCUS_NONE#

var language: String = ""#

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

var mouse_default_cursor_shape = CURSOR_POINTING_HAND#

var structured_text_bidi_override = STRUCTURED_TEXT_DEFAULT#

Set BiDi algorithm override for the structured text.

var structured_text_bidi_override_options: Array = []#

Set additional options for BiDi override.

var text: String = ""#

The button's text that will be displayed inside the button's area.

var text_direction = TEXT_DIRECTION_AUTO#

Base text writing direction.

var underline = UNDERLINE_MODE_ALWAYS#

The underline mode to use for the text. See LinkButton.UnderlineMode for the available modes.

var uri: String = ""#

The URI for this LinkButton. If set to a valid URI, pressing the button opens the URI using the operating system's default program for the protocol (via OS.shell_open). HTTP and HTTPS URLs open the default web browser.

GDScript

uri = "https://godotengine.org"  # Opens the URL in the default web browser.
uri = "C:\SomeFolder"  # Opens the file explorer at the given path.
uri = "C:\SomeImage.png"  # Opens the given image in the default viewing app.

C#

Uri = "https://godotengine.org"; // Opens the URL in the default web browser.
Uri = "C:\SomeFolder"; // Opens the file explorer at the given path.
Uri = "C:\SomeImage.png"; // Opens the given image in the default viewing app.

Methods #

Annotations #

Constants #

const UNDERLINE_MODE_ALWAYS = 0 enum UnderlineMode#

The LinkButton will always show an underline at the bottom of its text.

const UNDERLINE_MODE_ON_HOVER = 1 enum UnderlineMode#

The LinkButton will show an underline at the bottom of its text when the mouse cursor is over it.

const UNDERLINE_MODE_NEVER = 2 enum UnderlineMode#

The LinkButton will never show an underline at the bottom of its text.

Constructors #

Enums #

UnderlineMode#

enum UnderlineMode { UNDERLINE_MODE_ALWAYS = 0, UNDERLINE_MODE_ON_HOVER = 1, UNDERLINE_MODE_NEVER = 2, }

Operators #

Signals #

Theme Items #

self["theme_override_colors/font_color"] = Color(0.875, 0.875, 0.875, 1) as Color#

Default text Color of the LinkButton.

self["theme_override_colors/font_disabled_color"] = Color(0, 0, 0, 1) as Color#

Text Color used when the LinkButton is disabled.

self["theme_override_colors/font_focus_color"] = Color(0.95, 0.95, 0.95, 1) as Color#

Text Color used when the LinkButton is focused. Only replaces the normal text color of the button. Disabled, hovered, and pressed states take precedence over this color.

self["theme_override_colors/font_hover_color"] = Color(0.95, 0.95, 0.95, 1) as Color#

Text Color used when the LinkButton is being hovered.

self["theme_override_colors/font_hover_pressed_color"] = Color(0, 0, 0, 1) as Color#

Text Color used when the LinkButton is being hovered and pressed.

self["theme_override_colors/font_outline_color"] = Color(0, 0, 0, 1) as Color#

The tint of text outline of the LinkButton.

self["theme_override_colors/font_pressed_color"] = Color(1, 1, 1, 1) as Color#

Text Color used when the LinkButton is being pressed.

self["theme_override_constants/outline_size"] = 0 as int#

The size of the text outline.

Note: If using a font with FontFile.multichannel_signed_distance_field enabled, its FontFile.msdf_pixel_range must be set to at least twice the value of outline_size for outline rendering to look correct. Otherwise, the outline may appear to be cut off earlier than intended.

self["theme_override_constants/underline_spacing"] = 2 as int#

The vertical space between the baseline of text and the underline.

self["theme_override_fonts/font"] = font as Font#

Font of the LinkButton's text.

self["theme_override_font_sizes/font_size"] = font_size as int#

Font size of the LinkButton's text.

self["theme_override_styles/focus"] = style as StyleBox#

StyleBox used when the LinkButton is focused. The focus StyleBox is displayed over the base StyleBox, so a partially transparent StyleBox should be used to ensure the base StyleBox remains visible. A StyleBox that represents an outline or an underline works well for this purpose. To disable the focus visual effect, assign a StyleBoxEmpty resource. Note that disabling the focus visual effect will harm keyboard/controller navigation usability, so this is not recommended for accessibility reasons.

Tutorials #