How Can I Add Conditional Control Field In Inspector Controls Of Gutenberg?
I'm developing a countdown Block for Gutenberg. I have 7 styles in the block, So I want to show/hide some control fields in the inspector control based on the style. As far I know
Solution 1:
I've learned how to put the condition. The condition should be like this:
{ style == 2 && (
<PanelColor
title={ __( 'Text Bg Color', 'prefixx' ) }
colorValue={ textBgColor }
initialOpen={ false }
>
<ColorPalette
value={ textBgColor }
onChange={ textBgColor => setAttributes( { textBgColor } ) }
/>
</PanelColor>
) }
Post a Comment for "How Can I Add Conditional Control Field In Inspector Controls Of Gutenberg?"