Skip to main content

Block validation and warnings

1. Codelab overview

What you'll learn

This codelab will show you how to ensure that custom blocks either:

  1. have everything they need to be able to generate valid code, or
  2. display a visual warning to the user that the block is currently invalid.

What you'll build

In this codelab, you'll create a new custom block type that generates a list of numbers counting up within a given range. The block will validate itself and display a warning if the first number in the range is greater than the last number:

Two instances of a custom block, one with a validation warning.

You can find the code for the completed custom block on GitHub.

What you'll need