Stay organized with collections
Save and categorize content based on your preferences.
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. |
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 2024-09-18 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 2024-09-18 UTC."],[[["The `FieldCheckbox` class provides a UI element for representing a boolean value with a checkbox."],["This constructor initializes a new `FieldCheckbox` instance with an optional initial value, validator, and configuration options."],["The `value` parameter can be 'TRUE', 'FALSE', a boolean, or `Field.SKIP_SETUP` to delay setup in subclasses."],["The `validator` parameter is an optional function used to validate changes to the checkbox's value before they are applied."],["The `config` parameter allows for further customization of the checkbox using various properties defined in the field creation documentation."]]],[]]