blockly > FieldNumber > setConstraints

FieldNumber.setConstraints() method

Set the maximum, minimum and precision constraints on this field. Any of these properties may be undefined or NaN to be disabled. Setting precision (usually a power of 10) enforces a minimum step between values. That is, the user's value will rounded to the closest multiple of precision. The least significant digit place is inferred from the precision. Integers values can be enforces by choosing an integer precision.


setConstraints(min: number | string | undefined | null, max: number | string | undefined | null, precision: number | string | undefined | null): void;


Parameter Type Description
min number | string | undefined | null Minimum value.
max number | string | undefined | null Maximum value.
precision number | string | undefined | null Precision for value.