blockly > FieldCheckbox > (constructor)

FieldCheckbox.(constructor)

Constructs a new instance of the FieldCheckbox class

Signature:

constructor(value?: CheckboxBool | typeof Field.SKIP_SETUP, validator?: FieldCheckboxValidator, config?: FieldCheckboxConfig);

Parameters

Parameter Type Description
value CheckboxBool | typeof Field.SKIP_SETUP (Optional) The initial value of the field. Should either be 'TRUE', 'FALSE' or a boolean. Defaults to 'FALSE'. Also accepts Field.SKIP_SETUP if you wish to skip setup (only used by subclasses that want to handle configuration and setting the field value after their own constructors have run).
validator FieldCheckboxValidator (Optional) A function that is called to validate changes to the field's value. Takes in a value ('TRUE' or 'FALSE') & returns a validated value ('TRUE' or 'FALSE'), or null to abort the change.
config FieldCheckboxConfig (Optional) A map of options used to configure the field. See the [field creation documentation]https://developers.google.com/blockly/guides/create-custom-blocks/fields/built-in-fields/checkbox#creation for a list of properties this parameter supports.