Fields

Fields are used to define most UI elements on a block. Examples of fields include string labels, images, inputs for literal data such as strings and numbers, and rich editors like date pickers and angle pickers. The simplest example of a field is the math_number block, which uses a field_number to let the user type a number.

Blockly provides several fields by default to handle a variety of user input. These can be customized through field-specific configuration or with validators, which tell a field how to handle specific content in a standard editor.

→ More info on Built-in fields.

→ More info on Validators.

If you need a fully custom field it takes a bit more work and you'll want to read most of the fields documentation. Start by learning about the parts that make up a field or the overview of creating custom fields.

→ More info on the anatomy of a field.

→ More info on creating custom fields.