Stay organized with collections
Save and categorize content based on your preferences.
blockly > FieldCheckbox
FieldCheckbox class
Class for a checkbox field.
Signature:
export declare class FieldCheckbox extends Field<CheckboxBool>
Extends: Field<CheckboxBool>
Constructors
Properties
Property |
Modifiers |
Type |
Description |
CHECK_CHAR |
static
readonly
|
(not declared) |
Default character for the checkmark. |
SERIALIZABLE |
|
boolean |
Serializable fields are saved by the serializer, non-serializable fields are not. Editable fields should also be serializable. |
value_ |
|
boolean | null |
NOTE: The default value is set in Field , so maintain that value instead of overwriting it here or in the constructor. |
Methods
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-05-16 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-05-16 UTC."],[[["\u003cp\u003e\u003ccode\u003eFieldCheckbox\u003c/code\u003e is a Blockly class used to create checkbox fields within blocks.\u003c/p\u003e\n"],["\u003cp\u003eIt extends the base \u003ccode\u003eField\u003c/code\u003e class and provides functionality specific to checkboxes, such as setting the check character and toggling the state.\u003c/p\u003e\n"],["\u003cp\u003eThe value of a \u003ccode\u003eFieldCheckbox\u003c/code\u003e is either 'TRUE' or 'FALSE', representing the checked or unchecked state.\u003c/p\u003e\n"],["\u003cp\u003eDevelopers can customize the appearance and behavior of \u003ccode\u003eFieldCheckbox\u003c/code\u003e through properties like \u003ccode\u003eCHECK_CHAR\u003c/code\u003e and methods like \u003ccode\u003esetCheckCharacter\u003c/code\u003e.\u003c/p\u003e\n"]]],["The `FieldCheckbox` class, extending `Field`, represents a checkbox. Key actions include: constructing a new checkbox instance, configuring it with options, and validating input as 'TRUE' or 'FALSE'. It updates the field's value and check element. Methods allow retrieving the text, boolean value, and setting the check mark character. It also manages display text, initializes the block UI, handles rendering, and toggles the checkbox state on clicks. Default check mark characters are defined.\n"],null,["[blockly](./blockly.md) \\\u003e [FieldCheckbox](./blockly.fieldcheckbox_class.md)\n\nFieldCheckbox class\n-------------------\n\nClass for a checkbox field.\n\n**Signature:** \n\n export declare class FieldCheckbox extends Field\u003cCheckboxBool\u003e \n\n**Extends:** [Field](./blockly.field_class.md)\\\u003cCheckboxBool\\\u003e\n\nConstructors\n------------\n\n| Constructor | Modifiers | Description |\n|---------------------------------------------------------------------------------------------------------|-----------|--------------------------------------------------------|\n| [(constructor)(value, validator, config)](./blockly.fieldcheckbox_class._constructor__1_constructor.md) | | Constructs a new instance of the `FieldCheckbox` class |\n\nProperties\n----------\n\n| Property | Modifiers | Type | Description |\n|------------------------------------------------------------------------|---------------------|-----------------|--------------------------------------------------------------------------------------------------------------------------------|\n| [CHECK_CHAR](./blockly.fieldcheckbox_class.check_char_property.md) | `static` `readonly` | (not declared) | Default character for the checkmark. |\n| [SERIALIZABLE](./blockly.fieldcheckbox_class.serializable_property.md) | | boolean | Serializable fields are saved by the serializer, non-serializable fields are not. Editable fields should also be serializable. |\n| [value_](./blockly.fieldcheckbox_class.value__property.md) | | boolean \\| null | NOTE: The default value is set in `Field`, so maintain that value instead of overwriting it here or in the constructor. |\n\nMethods\n-------\n\n| Method | Modifiers | Description |\n|----------------------------------------------------------------------------------------------|-------------|---------------------------------------------------------------|\n| [configure_(config)](./blockly.fieldcheckbox_class.configure__1_method.md) | `protected` | Configure the field based on the given map of options. |\n| [doClassValidation_(newValue)](./blockly.fieldcheckbox_class.doclassvalidation__1_method.md) | `protected` | Ensure that the input value is valid ('TRUE' or 'FALSE'). |\n| [doValueUpdate_(newValue)](./blockly.fieldcheckbox_class.dovalueupdate__1_method.md) | `protected` | Update the value of the field, and update the checkElement. |\n| [getDisplayText_()](./blockly.fieldcheckbox_class.getdisplaytext__1_method.md) | | |\n| [getText()](./blockly.fieldcheckbox_class.gettext_1_method.md) | | Get the text of this field. Used when the block is collapsed. |\n| [getValue()](./blockly.fieldcheckbox_class.getvalue_1_method.md) | | Get the value of this field, either 'TRUE' or 'FALSE'. |\n| [getValueBoolean()](./blockly.fieldcheckbox_class.getvalueboolean_1_method.md) | | Get the boolean value of this field. |\n| [initView()](./blockly.fieldcheckbox_class.initview_1_method.md) | | Create the block UI for this checkbox. |\n| [render_()](./blockly.fieldcheckbox_class.render__1_method.md) | | |\n| [setCheckCharacter(character)](./blockly.fieldcheckbox_class.setcheckcharacter_1_method.md) | | Set the character used for the check mark. |\n| [showEditor_()](./blockly.fieldcheckbox_class.showeditor__1_method.md) | `protected` | Toggle the state of the checkbox on click. |"]]