Skip to main content

Home > blockly > FieldCheckbox

FieldCheckbox class

Class for a checkbox field.

Signature:

export declare class FieldCheckbox extends Field<CheckboxBool> 

Extends: Field<CheckboxBool>

Constructors

ConstructorModifiersDescription
(constructor)(value, validator, config)Constructs a new instance of the FieldCheckbox class

Properties

PropertyModifiersTypeDescription
CHECK_CHARstatic readonly(not declared)Default character for the checkmark.
SERIALIZABLEbooleanSerializable fields are saved by the serializer, non-serializable fields are not. Editable fields should also be serializable.
value_boolean | nullNOTE: The default value is set in Field, so maintain that value instead of overwriting it here or in the constructor.

Methods

MethodModifiersDescription
configure_(config)protectedConfigure the field based on the given map of options.
doClassValidation_(newValue)protectedEnsure that the input value is valid ('TRUE' or 'FALSE').
doValueUpdate_(newValue)protectedUpdate the value of the field, and update the checkElement.
getDisplayText_()
getText()Get the text of this field. Used when the block is collapsed.
getValue()Get the value of this field, either 'TRUE' or 'FALSE'.
getValueBoolean()Get the boolean value of this field.
initView()Create the block UI for this checkbox.
render_()
setCheckCharacter(character)Set the character used for the check mark.
showEditor_()protectedToggle the state of the checkbox on click.