Skip to main content

Home > 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

ParameterTypeDescription
valueCheckboxBool | 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).
validatorFieldCheckboxValidator(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.
configFieldCheckboxConfig(Optional) A map of options used to configure the field. See the field creation documentation for a list of properties this parameter supports.