Introduction
Block components are the fundamental building blocks of AppFlowy Editor. Each block component represents a distinct type of content, from simple text paragraphs to complex tables. The block component system provides a flexible and extensible architecture for creating rich document structures.Architecture
Core Components
The block component system consists of three main parts:- BlockComponentBuilder - Factory class that creates block component widgets
- BlockComponentWidget - The stateful widget that renders the block
- Node - The data model that contains block attributes and content
Block Component Configuration
All block components share a common configuration system throughBlockComponentConfiguration:
padding- Vertical/horizontal padding for the blockindentPadding- Padding for nested/indented blocksplaceholderText- Text displayed when block is emptytextStyle- Text styling functionplaceholderTextStyle- Styling for placeholder textblockSelectionAreaMargin- Selection area marginstextAlign- Text alignment (start, center, end)
Available Block Types
Paragraph
Basic text block with rich text formatting
Heading
Headings from H1 to H6 with configurable styles
Bulleted List
Unordered lists with nested support
Numbered List
Ordered lists with automatic numbering
Quote
Block quotes with custom styling
Divider
Horizontal divider lines
Image
Resizable images with alignment
Table
Multi-cell tables with dynamic sizing
Custom Blocks
Create your own block components
Standard Block Components
AppFlowy Editor provides a complete set of standard block components throughstandardBlockComponentBuilderMap:
Key Concepts
Node Structure
Each block is represented by aNode with:
- type - String identifier (e.g., ‘paragraph’, ‘heading’)
- attributes - Map of block-specific data
- children - List of child nodes for nesting
Delta Format
Text-based blocks use the Delta format for rich text content:Mixins for Common Functionality
Block components use mixins to share functionality:- SelectableMixin - Selection handling
- DefaultSelectableMixin - Default selection behavior
- BlockComponentConfigurable - Configuration access
- BlockComponentBackgroundColorMixin - Background color support
- BlockComponentTextDirectionMixin - Text direction (LTR/RTL)
- BlockComponentAlignMixin - Alignment support
- NestedBlockComponentStatefulWidgetMixin - Nested children support
Block Validation
Each block component implements a validation function:Selection & Actions
Block components support:- Block Selection - Select entire blocks
- Text Selection - Select text within blocks
- Action Builders - Custom actions (drag handles, menus)
- Remote Selection - Collaborative cursor display
Next Steps
Text Blocks
Learn about paragraph blocks and text formatting
Custom Blocks
Create your own custom block components