In this lesson, we will let the user pick a color for the button. There are a few options when it comes to adding color to your custom block like ColorPalette, ColorPicker, and PanelColorSettings.

Attribute for storing color

We need access to the button's color in both the editor and the frontend. This calls for making it an attribute. Open the block.json file. We will create a new attribute called buttonColor.

Get hands-on with 1200+ tech skills courses.