shramee
shramee

Reputation: 5099

Add fields in advanced block setting

Trying to build a custom block with settings in Advanced block settings tab which opens in the sidebar on RHS...

WordPress' default blocks seem to have settings there but unfortunately can't find it documented anywhere...

Any pointers would be really helpful!

Upvotes: 3

Views: 1524

Answers (1)

James W.
James W.

Reputation: 184

Update 2018/08/16 The inspector controls links seem to have moved as Gutenberg developed since I originally wrote this.

The rough idea is that everything you add as a child of <InspectorControls>, will be at the sidebar when the user focuses on your block:

return (
    <InspectorControls> 
        {/* Whatever is inside this block will be displayed on the sidebar */} . 
    </InspectorControls>
        {/* Whatever is outside, will be displayed on the editor as usual */}
)

Take a look at this article for reference:

https://medium.com/@eudestwt/how-to-make-an-editable-wordpress-gutenberg-block-with-inspector-controls-on-the-sidebar-8779f4eddf8e


I think what you're looking for are Gutenberg's InspectorControls. I have found an example from lucasstark/gutenberg-gravityforms that shows them in use.

Digging through the Gutenberg I have found the following options but no official docs (best they have is this) showing off their usage:

Hope that helps.

Upvotes: 2

Related Questions