2

How to render core block such as core/columns inside custom registered block in Gutenberg?

I found this as an example, but I don't really understand how to render it inside my own block with edit().

I thought of using something like createBlock('core/columns'), but it gives an error on render.

2

You can make use of components inside your block. However, to insert a block inside your block you need to make use of the editor component Innerblocks. Using it you can set a predefined template which includes certain blocks in a specific order. Or you can set allowed blocks that can be added by the user.

For example, the columns block uses Innerblocks component and includes the column block using the template prop, which uses again Innerblocks to allow any kind of block to be added inside each column.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.