Skip to main content
InnerBlocks allows you to create container blocks that can contain other blocks. This enables building complex layouts like columns, groups, and custom sections.

Basic Usage

InnerBlocks exports a pair of components for the edit and save functions:
A block can render at most a single InnerBlocks component in edit and a single InnerBlocks.Content in save.

Complete Example: Section Block

block.json
edit.js
save.js

InnerBlocks Props

allowedBlocks

array | boolean
default:"true"
Restrict which block types can be inserted
Restrict to no blocks except children:
Allow all blocks:
Child blocks that mark themselves as compatible with a parent block are never excluded, even if not in allowedBlocks.

template

array
Predefined block structure to initialize InnerBlocks with

Nested Template

templateLock

string | boolean
Controls how users can modify the template structure
Options:
  • 'all' - Prevents all operations (insert, move, delete)
  • 'insert' - Prevents inserting/removing, but allows moving
  • 'contentOnly' - Prevents all operations and hides non-content blocks
  • false - No locking (default)

Real Example: Columns Block

From packages/block-library/src/columns: block.json

orientation

'horizontal' | 'vertical'
default:"'vertical'"
Display direction for block movers and drag-and-drop
Useful for blocks like buttons where items are arranged horizontally.

renderAppender

Component | false
Component to render at the end of the blocks list

Built-in Appenders

Custom Appender

placeholder

Component
Component shown before any blocks are added

defaultBlock

object
Default block type and attributes for new insertions

directInsert

boolean
default:"false"
Whether to insert the default block directly without showing the inserter

prioritizedInserterBlocks

array
Block types to show first in the inserter

templateInsertUpdatesSelection

boolean
default:"false"
Whether inserting template blocks updates the selection

Advanced Examples

Testimonial Block with Fixed Structure

Card Block with Specific Allowed Blocks

Accordion Item with Content Lock

Using with useInnerBlocksProps

For more advanced use cases, use useInnerBlocksProps:

Real-World Example: Group Block

From packages/block-library/src/group: block.json

Parent-Child Relationships

Use the parent property in block.json to restrict where a block can be used: Child block (core/column):
Parent block (core/columns):

Dynamic InnerBlocks (Server-side Rendering)

For dynamic blocks, InnerBlocks content is available in PHP:
edit.js (same as static blocks):
save.js (for dynamic blocks, return null):

Block Appender Customization

Conditional Appender

Best Practices

The save function must render <InnerBlocks.Content /> exactly where the edit function renders <InnerBlocks />.
Templates help users start with the right block configuration and maintain consistency.
Use allowedBlocks to prevent users from adding blocks that don’t work well in your layout.
Lock templates when structure is important, but allow users to edit content.
Define parent constraints to ensure child blocks are only used where appropriate.

Common Patterns

Two-Column Layout

Media-Text Pattern

Accessing Inner Blocks Data

Use the block editor selectors to work with inner blocks:

Next Steps

Block Patterns

Create reusable layouts with patterns

Block API Overview

Return to core Block API concepts