Change order/position of Gutenberg inspector control panel
-
23-03-2021 - |
Question
I'm adding a new panel to a Gutenberg block through the editor.BlockEdit
wp.block filter.
<InspectorControls>
<PanelBody title={ __( 'New Settings' ) } initialOpen={ false } >
...
</PanelBody>
</InspectorControls>
The new panel appears on top of the default panels. Is there any way to change the order? To make it show below other panels? I did not find any documentation about this..
Solution
<InspectorControls>
<PanelBody title={ __( 'Settings One' ) }>
</PanelBody>
<PanelBody title={ __( 'Settings Two' ) }>
</PanelBody>
<PanelBody title={ __( 'Settings Three' ) >
</PanelBody>
</InspectorControls>
If you insert multiple Panelbody like I did in above code. You will have multiple inspector controls with first one being ope by default. Change the panelbody accordingly to match your desired order.
Licensed under: CC-BY-SA with attribution
Not affiliated with wordpress.stackexchange