Skip to content

Explore a concept for composite blocks (a container block with a fixed set of inner blocks, with some UX tweaking) #70994

Open

Description

@andrewserong

What problem does this address?

For plugins, but also in core, there are many cases where a block will ideally be made up of a finite set of smaller blocks, with a single wrapper. In a form plugin this could be an "Email block" made up of a "label" and an "input" block. But in core, I think there's a possible example in the Details block.

The Details block was originally introduced in #45055 using an inner blocks structure, but was then simplified in #49808 to remove the inner summary and content blocks in order to reduce its complexity. This achieved a simplicity of interacting with the block, but has the downside that the summary cannot be styled independently of the content within the details block.

The purpose of this issue isn't to fix the Details block, but rather to discuss this broader category of blocks, that we might call composite blocks, where we want some of the benefits of a granular block structure (being able to style sub-parts of the block independently and within global styles), but where we'd also like a simplified UX for interacting with the block.

I've chatted with a few folks who work on plugins and with core, and the idea was floated that there should be a core-first way of supporting such blocks, so this issue is an attempt to capture this idea and help come up with a path forward for supporting such things. If we succeed, maybe one side effect could be ensuring the Details block supports styling the summary independently of the details content. And plugins could have a canonical way of developing blocks in this way.

What is your proposed solution?

I mostly have questions at this stage, but from the comments in #49808, it seems the following considerations will likely need to be in play. Here are some ideas or questions (note that I'm not a designer!):

  • Create a way to define a wrapper block that uses inner blocks as a composite block. This could enable:
    • When you first click any child within the composite block, it auto-selects the containing block so that it feels like a single block
    • Option 1 — from there, we could display a list of the inner blocks in the right-hand sidebar (like the navigation block does), and allow folks to click within to select child blocks
    • Option 2 — expose the styling controls from the inner blocks within the inspector controls for the parent block. I.e. possibly by using tabs or drill down screens?
    • Also, depending on how far things should be abstracted, would we hide the inner blocks within the list view tree?
    • Is there any other behaviour we'd want in order to make the UX feel smooth for such blocks?

I'm not too sure the right approach for "how" at this stage, but I'd love to hear if any designers have ideas on how this might ideally work.

Some inspiration

The Navigation block is an interesting one as it goes part of the way toward solving this for itself:

Navigation Block (shows a list of children) Page List child block (shows a back arrow to parent)
Image Image

But also, I think there could be some overlap here with writing and contentOnly modes (#60021) (or at least in how we display things visually), as content only mode shows this Content panel to display the inner structure. I wonder if something like that can be inspiration for how we might expose the different parts of a composite block:

Image

That's the idea so far. Would love to hear anyone's thoughts!

Activity

  1. added
    [Type] Enhancement
    [Feature] Nested / Inner Blocks
    Needs Design Feedback
    on Jul 31, 2025
  2. PurvaSJadhav commented on Jul 31, 2025

    @PurvaSJadhav

    Hi @andrewserong 👋,

    I'd like to work on this issue and explore a possible solution for composite blocks, especially focusing on enhancing the UX for container blocks with a fixed set of inner blocks.

    Here’s the approach I plan to follow:

    1. Analyze the current behavior of the Navigation and Details blocks to understand how inner block selection, structure, and styling are managed.
    2. Prototype a composite block structure using InnerBlocks with a predefined template (e.g., summary and content) to ensure a fixed layout.
    3. Implement UX improvements, such as:
      • Auto-selecting the parent block when a child is clicked
      • Displaying inner block controls in the sidebar using tabs or drill-down UI
      • Optionally hiding inner blocks in the List View for a cleaner experience
    4. Validate the experience by testing scenarios like form elements or collapsible sections, ensuring that style controls remain intuitive and accessible.

    Let me know if this direction aligns with the intended goals, or if you have suggestions before I get started.

    Thanks!

  3. talldan commented on Jul 31, 2025

    @talldan
    Contributor

    Option 1 — from there, we could display a list of the inner blocks in the right-hand sidebar (like the navigation block does), and allow folks to click within to select child blocks
    Option 2 — expose the styling controls from the inner blocks within the inspector controls for the parent block. I.e. possibly by using tabs or drill down screens?

    For me there are pros and cons with the approaches:

    • Option 1 scales to a lot of inner blocks (especially where the user might be adding additional blocks), but requires an extra tab in the inspector, and perhaps it's still a little challenging to navigate the hierarchy.
    • Option 2 doesn't scale to many inner blocks, but makes it much easier to navigate (I imagine).

    For option 2 there are probably quite a few different options for the inspector UI. I could also imagine a way to select the inner block above the inspector tabs, or even expandable panels for the inner blocks with the tools nested within. Finding a balance between something that's easy to use but works within the limited space is a challenge. 🤔

  4. hanneslsm commented on Jul 31, 2025

    @hanneslsm

    Love the idea @andrewserong !

    One thing that comes to mind and maybe we should consider already in an early stage is how conditional blocks can be displayed and are effected.
    What I mean is that we might not only look at that a composite block is a wrapper for children (like details or navigation) but for child-blocks with the same hierarchy, like the query block with a post template and no results block. Do changes in the composite block effect all inner blocks or can exceptions be defined?

    UX-example: Woo for examples uses a differently UX for conditionals than the core Query loop by adding the selection in the toolbar.
    Image

    Image

    I don't have a strong opinion on your proposed Option 1 or 2 but I think it's important that we consider where majority of the UX is happening (list view, toolbar, right sidebar, editor).

  5. talldan commented on Nov 24, 2025

    @talldan
    Contributor

    The Accordion Item block is another that has this issue at the moment. It uses templateLock: 'all' currently. There's a bug in trunk now because if a user sets templateLock: 'contentOnly', it overrides the templateLock: 'all' (#73425 (comment)), which changes how the accordion block behaves.

    The blocks also have lock icons in trunk, and that's not particularly desirable, as it makes the user think they can unlock the blocks:
    Image

    Perhaps an early simple version of this feature could be explored. It could be very similar to templateLock: 'all', but:

    • Not be overridden by templateLock: 'contentOnly'
    • Not show the lock icons on child blocks.

    The ideas around flattening the block hierarchy could be later iterations.

    The biggest question for me is what the API looks like. It's a shame to have to add yet another API, but I think it might be necessary, and I think it might have to be a separate feature from templateLock so that it doesn't interrupt how templateLock inheritance works.

  6. t-hamano commented on Nov 24, 2025

    @t-hamano
    Contributor

    @talldan Thank you for looking into the issue.

    It seems that it was an intended specification from the beginning that templateLock cannot be overridden by a child. See #43037 (comment)

  7. talldan commented on Nov 24, 2025

    @talldan
    Contributor

    @t-hamano I've tried a simple PR to solve the issues - #73510.

    It should be testable, but I haven't completely finished (needs automated tests and screencap in the PR description), and I've run out of time today, I'll finish it off tomorrow.

  8. eric-michel commented on Oct 12, 2026

    @eric-michel

    Thanks for directing me here, @youknowriad !

    I run into this issue on a regular basis when working on custom blocks that have a rigid structure. I'm forced to make one of two imperfect choices:

    1. Use components (like RichText) to create a sensible structure for content entry, but severely limit my formatting options or
    2. Create a series of default InnerBlocks (which can be independently formatted) and attempt to lock them such that the user does not remove, rearrange, or add to them

    I usually opt for default InnerBlocks, but as @andrewserong points out, the UI is clunky at best. And a determined user could probably break the block if they really wanted to via unlocking and futzing with the InnerBlocks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs Design Feedback[Feature] Nested / Inner Blocks[Type] Enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions