Button

Inherits: BaseButton < Control < CanvasItem < Node < Object

Inherited By: CheckBox, CheckButton, ColorPickerButton, MenuButton, OptionButton, ToolButton

Standard themed Button.

Description

Button is the standard themed button. It can contain text and an icon, and will display them according to the current Theme.

Theme Properties

StyleBoxdisabled 
StyleBoxfocus 
Fontfont 
Colorfont_colorColor( 0.88, 0.88, 0.88, 1 )
Colorfont_color_disabledColor( 0.9, 0.9, 0.9, 0.2 )
Colorfont_color_hoverColor( 0.94, 0.94, 0.94, 1 )
Colorfont_color_pressedColor( 1, 1, 1, 1 )
StyleBoxhover 
inthseparation2
StyleBoxnormal 
StyleBoxpressed 

Enumerations

enum TextAlign:

  • ALIGN_LEFT = 0 — Align the text to the left.
  • ALIGN_CENTER = 1 — Align the text to the center.
  • ALIGN_RIGHT = 2 — Align the text to the right.

Property Descriptions

Default1
Setterset_text_align(value)
Getterget_text_align()

Text alignment policy for the button’s text, use one of the TextAlign constants.


Defaultfalse
Setterset_clip_text(value)
Getterget_clip_text()

When this property is enabled, text that is too large to fit the button is clipped, when disabled the Button will always be wide enough to hold the text.


Defaultfalse
Setterset_expand_icon(value)
Getteris_expand_icon()

When enabled, the button’s icon will expand/shrink to fit the button’s size while keeping its aspect.


Defaultfalse
Setterset_flat(value)
Getteris_flat()

Flat buttons don’t display decoration.


Setterset_button_icon(value)
Getterget_button_icon()

Button’s icon, if text is present the icon will be placed before the text.


Default""
Setterset_text(value)
Getterget_text()

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

Doc ID missing

Disclaimer: This page has been automaticaly and directly extracted from the official Godot Docs website, the 1970-01-01 at 00:00:00. It’s the English Stable version because it’s what most Godot users should use. The Copyright owners are Juan Linietsky, Ariel Manzur and the Godot community. CC-BY 3.0. Thanks for your patience and generosity.