Add metabox to document tab in gutenberg

enter image description here

How can I add custom metabox in document tab in gutenberg?

There is documentation about adding plugin sidebar here, but I’m looking for adding custom metabox in existing document tab.

3 s
3

Here is the solution. Hope it will help you

const { registerPlugin } = wp.plugins;
const { PluginDocumentSettingPanel } = wp.editPost;

const MyDocumentSettingTest = () => (
        &ltPluginDocumentSettingPanel className="my-document-setting-plugin" title="My Panel"&gt
            &ltp>My Document Setting Panel&lt/p>
        &lt/PluginDocumentSettingPanel>
    );

registerPlugin( 'document-setting-test', { render: MyDocumentSettingTest } );

https://github.com/WordPress/gutenberg/blob/master/packages/edit-post/src/components/sidebar/plugin-document-setting-panel/index.js#L86

Leave a Comment