Nested Components (inner blocks)

Hey there,

whenever I work with components there is one thing I always like to achieve but, if im not wrong, it is not possible yet. Defining an area of the component which accepts children, similar to the Innerblock feature of Gutenberg: Nested Blocks: Using InnerBlocks | Block Editor Handbook | WordPress Developer Resources. Doesn’t need to be multiple Areas in my opinion, but it would be very cool if they could accept any Blocks.

For Example my designer provided me the following mockup. That “CTA” Section is repeated throughout the whole website, but with different Images, different heading and different buttons. That’s all perfectly fine in doing within the current implementation. But that red banner…the amount of heading/text varies from 1-3…so I would need something more dynamic. For me the best solution would be if I could define the red banner as a “nestable area” and could add there the blocks needed. I would style that red banner via relative styles to make sure, that the design is consistent, but with that flexible approach I could add anything inside that banner.

Would love to hear your thoughts on this.

Cheers
Wolfgang

Hi @Wolfgang,

This is already supported by Cwicly components.

Screenshot 2023-12-14 at 15.55.06

There may be a bug currently with regards to displaying in the editor when selected:

Aside from that it should just work.

Did not know about the existence of inner blocks. I’ll check it out.

Nooo wayyy! :slight_smile: Thanks @StrangeTech I could swear that I’ve typed in “inner blocks” but didn’t find it…

Thats soooo cooool! :slight_smile:

1 Like

Were you able to find inner blocks? I can’t either which is making it impossible to use the same nested component on one page.

@dbeals, As shown in my screenshot you can simply insert an Inner Blocks block into your component.

Dangit… it doesn’t show up when I search for it…

You have to be modifying the component and it is easiest to use the block selector in the editor toolbar:

You are by far my favorite person of the week. Thank you.

2 Likes