Customizing fields

While Blockly provides many useful fields, your application may have a specialized case. Here are a few steps to take when customizing fields:

  1. Read the documentation of any fields similar to what you require; they may provide a useful interface for customization. For example, dropdowns have a lot of hidden functionality.

  2. Consider using a validator to solve your problem. Validators allow you to only accept certain values, modify input, or trigger functionality when a field's value changes.

  3. Consider extending a field. If there is a field that represents the value type you require, but you want to modify its editor, its appearance, or the text it displays, you can create a subclass that inherits the bulk of the functionality, while overriding the specific parts you want to change.

  4. Create a new field type. While this is the most powerful option, it is also the most time consuming, and should generally only be used if you need to store a new value type.