Skip to main content
The WordPress block editor can be used to create custom block editors for virtually any web application. The @wordpress/block-editor package provides the core functionality you need to build standalone editors outside of traditional WordPress contexts.

What You’ll Build

This guide walks you through creating a fully functioning custom block editor with:
  • Ability to add and edit all Core blocks
  • Familiar visual styles and main/sidebar layout
  • Basic block persistence between page reloads

Core Concepts

The BlockEditorProvider

<BlockEditorProvider> is the foundation of any block editor instance. It establishes a new block editing context:
The value prop accepts an array of parsed block objects. Use onInput for in-memory updates and onChange for committed changes that should be persisted.

BlockList Component

<BlockList> renders the list of blocks in your editor:
The component hierarchy works as follows:
  • <BlockList> loops over all block clientIds
  • <BlockListBlock> renders each individual block
  • <BlockEdit> renders the editable area
  • The block’s edit() implementation renders the actual UI

Setting Up Your Editor

Register Core Blocks

Before rendering your editor, register the blocks you want to support:

Editor Layout

Create a complete editor layout with regions:
Wrap your editor in navigateRegions HOC to enable keyboard navigation between different regions like header, sidebar, and main content area.

Block Persistence

Storing Blocks

Use the onChange handler to persist blocks:

Restoring Blocks

Load blocks when the editor initializes:

Inspector Controls

Add a sidebar with block settings using <BlockInspector>:
Use Slot/Fill to render <BlockInspector> in your sidebar while keeping it within the React context of <BlockEditorProvider>.

Editor Settings

Configure your editor with settings:

Complete Example

Here’s a minimal custom block editor:

Resources