CheckBox

Inherits: Button < BaseButton < Control < CanvasItem < Node < Object

Binary choice user interface widget. See also CheckButton.

Description

A checkbox allows the user to make a binary choice (choosing only one of two possible options). It's similar to CheckButton in functionality, but it has a different appearance. To follow established UX patterns, it's recommended to use CheckBox when toggling it has no immediate effect on something. For instance, it should be used when toggling it will only do something once a confirmation button is pressed.

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

Properties

HorizontalAlignment

alignment

0 (overrides Button)

bool

toggle_mode

true (overrides BaseButton)

Theme Properties

Color

font_color

Color(0.875, 0.875, 0.875, 1)

Color

font_disabled_color

Color(0.875, 0.875, 0.875, 0.5)

Color

font_focus_color

Color(0.95, 0.95, 0.95, 1)

Color

font_hover_color

Color(0.95, 0.95, 0.95, 1)

Color

font_hover_pressed_color

Color(1, 1, 1, 1)

Color

font_outline_color

Color(1, 1, 1, 1)

Color

font_pressed_color

Color(1, 1, 1, 1)

int

check_vadjust

0

int

hseparation

4

int

outline_size

0

Font

font

int

font_size

Texture2D

checked

Texture2D

checked_disabled

Texture2D

radio_checked

Texture2D

radio_checked_disabled

Texture2D

radio_unchecked

Texture2D

radio_unchecked_disabled

Texture2D

unchecked

Texture2D

unchecked_disabled

StyleBox

disabled

StyleBox

focus

StyleBox

hover

StyleBox

hover_pressed

StyleBox

normal

StyleBox

pressed

Theme Property Descriptions

Default

Color(0.875, 0.875, 0.875, 1)

The CheckBox text's font color.


  • Color font_disabled_color

Default

Color(0.875, 0.875, 0.875, 0.5)

The CheckBox text's font color when it's disabled.


Default

Color(0.95, 0.95, 0.95, 1)

The CheckBox text's font color when it's focused. Only replaces the normal text color of the checkbox. Disabled, hovered, and pressed states take precedence over this color.


Default

Color(0.95, 0.95, 0.95, 1)

The CheckBox text's font color when it's hovered.


  • Color font_hover_pressed_color

Default

Color(1, 1, 1, 1)

The CheckBox text's font color when it's hovered and pressed.


  • Color font_outline_color

Default

Color(1, 1, 1, 1)

The tint of text outline of the CheckBox.


  • Color font_pressed_color

Default

Color(1, 1, 1, 1)

The CheckBox text's font color when it's pressed.


  • int check_vadjust

Default

0

The vertical offset used when rendering the check icons (in pixels).


  • int hseparation

Default

4

The separation between the check icon and the text (in pixels).


  • int outline_size

Default

0

The size of the text outline.


The Font to use for the CheckBox text.


  • int font_size

Font size of the CheckBox's text.


The check icon to display when the CheckBox is checked.


The check icon to display when the CheckBox is checked and disabled.


If the CheckBox is configured as a radio button, the icon to display when the CheckBox is checked.



If the CheckBox is configured as a radio button, the icon to display when the CheckBox is unchecked.



The check icon to display when the CheckBox is unchecked.


The check icon to display when the CheckBox is unchecked and disabled.


The StyleBox to display as a background when the CheckBox is disabled.


The StyleBox to display as a background when the CheckBox 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.


The StyleBox to display as a background when the CheckBox is hovered.


The StyleBox to display as a background when the CheckBox is hovered and pressed.


The StyleBox to display as a background.


The StyleBox to display as a background when the CheckBox is pressed.