Why use React/JS to create a Meta Box

In my previous post I mentioned that the reason why we need to learn to do this is to get all the new features. But what is the new features?

You can read more in my previous post: Custom Field & Meta Box in Gutenberg Editor.

In this short blog post, I want to give a simple example, to transform the field to a full sidebar panel.

From this:

To this (video):

How cool is that?

And we can do this very easily. We simply need to change our code from:

<PluginDocumentSettingPanel name="my-data" title="My Data">
	<TextControl value={myData} onChange={setMyData} />

To this:

	<PluginSidebarMoreMenuItem target={sidebarName}>
		{ sidebarLabel }
	<PluginSidebar name={sidebarName} title={ sidebarLabel }>
			<TextControl value={myData} onChange={setMyData} />

So, basically we simply change the wrapper from PluginDocumentSettingPanel to PluginSidebar.

I create a new branch “feature/sidebar-panel”, you can download it on GitHub:


Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.