Skip to main content

Home > blockly > Field > (constructor)

Field.(constructor)

Constructs a new instance of the Field class

Signature:

constructor(value: T | typeof Field.SKIP_SETUP, validator?: FieldValidator<T> | null, config?: FieldConfig);

Parameters

ParameterTypeDescription
valueT | typeof Field.SKIP_SETUPThe initial value of the field. 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).
validatorFieldValidator<T> | null(Optional) A function that is called to validate changes to the field's value. Takes in a value & returns a validated value, or null to abort the change.
configFieldConfig(Optional) A map of options used to configure the field. Refer to the individual field's documentation for a list of properties this parameter supports.