Skip to content
Eduard Gushchin edited this page Jul 1, 2026 · 3 revisions

Home | API by Category | Complete API Index | API Compatibility

Field Value
Full name Electron2D.Button
Namespace Electron2D
Kind class
Category UI and Text

Overview

Provides a text button control.

Syntax

public class Electron2D.Button : Electron2D.BaseButton

Godot 4.7 C# profile compatibility

Profile: Electron2D 0.1.0 2D
Status: Supported / Parity verified
Out of profile: no
Godot reference: Button

Text button control backed by BaseButton input, signals, minimum size and basic text drawing.

Remarks

Button builds on Electron2D.BaseButton and draws a simple text label using the inherited font and font_size theme overrides.

Thread Safety

This type is not synchronized. Create and mutate buttons on the main scene thread.

Since

This type is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.BaseButton
  • Electron2D.CheckBox

Members

Member Kind Summary
Text Property Gets or sets the text displayed by this button.
Electron2D.Button() Constructor Initializes a new instance of the Electron2D.Button class.
_Draw() Method Draws the button background and text.
_GetMinimumSize() Method Gets the minimum size requested by this button.

Member Details

Text

Kind: Property

public System.String Text { get; set; }

Summary

Gets or sets the text displayed by this button.

Remarks

Assigning text queues a redraw. Empty text is valid and draws only the button background.

Value

The button text. The value is never null.

Exceptions

  • System.ArgumentNullException: Thrown when the assigned value is null.

Thread Safety

This property is not synchronized. Mutate it on the main scene thread.

Since

This property is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.Button

Electron2D.Button()

Kind: Constructor

public Electron2D.Button()

Summary

Initializes a new instance of the Electron2D.Button class.

Remarks

The new button inherits signal and focus defaults from Electron2D.BaseButton.

Thread Safety

This constructor is not synchronized. Call it from the main scene thread.

Since

This constructor is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.Button

_Draw()

Kind: Method

public System.Void _Draw()()

Summary

Draws the button background and text.

Remarks

The preview drawing path uses neutral colors and theme font overrides. Full theme style boxes are outside this task.

Thread Safety

This callback is invoked on the main scene thread.

Since

This method is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.BaseButton

_GetMinimumSize()

Kind: Method

public Electron2D.Vector2 _GetMinimumSize()()

Summary

Gets the minimum size requested by this button.

Remarks

If no font override is available, the method returns a conservative text-independent fallback.

Returns

A size large enough to contain the current text and button padding.

Thread Safety

This callback is invoked on the main scene thread.

Since

This method is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.Control.GetMinimumSize

Clone this wiki locally