Skip to main content
You can create blocks that contain other blocks using the InnerBlocks component. This pattern is used in blocks like Columns, Group, Cover, and any block where you want to nest content.
A single block can only contain one InnerBlocks component.

Basic Usage

Here’s the simplest implementation of InnerBlocks:

InnerBlocks.Content

In the save function, use <InnerBlocks.Content /> to render the saved inner blocks:
This outputs the actual saved content of all nested blocks.

Controlling Allowed Blocks

Limit which blocks can be inserted as children:

Dynamic Allow List

Use the allowedBlocks prop for dynamic control:

Static Allow List

For a fixed list, use the allowedBlocks setting in block.json:

Block Templates

Prefill InnerBlocks with a default template:
When the block is first inserted, it will contain these three blocks with their placeholder values.

Template Locking

Control how users can modify the template:
Lock options:
  • all - Prevents all operations (no insert, move, or delete)
  • insert - Prevents inserting/removing blocks (allows reordering)
  • contentOnly - Only allows editing block content
  • false - No locking (default)

Complete Template Example

Nested Templates

Templates can include nested inner blocks:

Orientation

For horizontally-styled blocks, set the orientation:
This:
  • Displays block movers horizontally
  • Ensures drag and drop works correctly
  • Doesn’t affect the actual layout (use CSS for that)

Default Block

Specify which block is inserted when the user clicks the appender:
The directInsert prop makes the default block insert immediately without showing the block picker.

Block Relationships

Control where blocks can be inserted using parent/child relationships.

Parent Relationship

A block can only be a direct child of specified parents:
The Column block only appears as an option inside Columns blocks.

Ancestor Relationship

A block can be anywhere in the tree under specified ancestors:
Comment Author Name can be deeply nested, as long as it’s somewhere inside Comment Template.

Allowed Blocks (Children)

Specify which blocks can be direct children:

Comparison

Using useInnerBlocksProps Hook

For more control over markup, use the useInnerBlocksProps hook:

Merging Props

You can merge blockProps and innerBlocksProps:

Accessing Children

Destructure children to add elements alongside inner blocks:

Complete Hook Example

Post Templates vs InnerBlocks Templates

InnerBlocks Template

Defines default blocks inside a specific block:

Post Template

Defines default blocks for an entire post type:

Complete Example: Testimonial Block

Best Practices

  1. One InnerBlocks per block: You can only have one InnerBlocks component per block
  2. Always use InnerBlocks.Content: In the save function, use <InnerBlocks.Content /> not <InnerBlocks />
  3. Consider template locking: Decide if users should modify the structure
  4. Use semantic HTML: Choose appropriate wrapper elements (div, section, article, etc.)
  5. Test deeply nested scenarios: Ensure your block works when nested multiple levels deep
  6. Provide clear templates: Make placeholder text descriptive

Common Patterns

Two-Column Layout

Hero Section