How to add a gradient component to a custom block

The documentation for that control does not exist at this time. Instructions have not been written yet. It is an experimental component.


You need to use an appropriate control in your blocks Edit component.

Note that these are very new components, their design will likely change, it should be considered experimental and unstable.

There is the GradientPicker component, https://github.com/WordPress/gutenberg/blob/master/packages/components/src/gradient-picker/index.js

And ColorGradientControl https://github.com/WordPress/gutenberg/blob/26e4d59e6fd3ed78d0213d60abca31c6dc1fa9cb/packages/block-editor/src/components/colors-gradients/control.js

        <ColorGradientControl
            { ...otherProps }
            onColorChange={ onChange }
            colorValue={ value }
            gradients={ [] }
            disableCustomGradients={ true }
        />