Overview
Paragraph blocks are the most fundamental text block type in AppFlowy Editor. They support rich text formatting, text direction, alignment, and background colors.Block Keys
Paragraph blocks use the following keys:Creating Paragraph Nodes
You can create paragraph nodes using theparagraphNode() helper function:
/lib/src/editor/block_component/paragraph_block_component/paragraph_block_component.dart:16
Paragraph Component Builder
Create a custom paragraph component with configuration:/lib/src/editor/block_component/paragraph_block_component/paragraph_block_component.dart:38
Widget Structure
The paragraph block widget is structured as follows:Mixins Used
The paragraph component state uses several mixins:- SelectableMixin - Text selection and cursor handling
- DefaultSelectableMixin - Default selection behaviors
- BlockComponentConfigurable - Access to configuration
- BlockComponentBackgroundColorMixin - Background color styling
- NestedBlockComponentStatefulWidgetMixin - Support for nested children
- BlockComponentTextDirectionMixin - LTR/RTL text direction
- BlockComponentAlignMixin - Text alignment (left, center, right)
/lib/src/editor/block_component/paragraph_block_component/paragraph_block_component.dart:89
Placeholder Handling
The paragraph block shows a placeholder when empty:/lib/src/editor/block_component/paragraph_block_component/paragraph_block_component.dart:131
Rich Text Rendering
Paragraphs useAppFlowyRichText for rendering:
/lib/src/editor/block_component/paragraph_block_component/paragraph_block_component.dart:165
Using in Editor
Add paragraph support to your editor:Inserting Paragraphs
Customizing Text Style
Override the text style configuration:Key Features
- Rich Text Support - Full Delta format with inline styling
- Text Direction - LTR and RTL support
- Text Alignment - Left, center, right, justify
- Background Color - Custom background colors
- Placeholder Text - Configurable empty state text
- Nested Children - Can contain child blocks
- Selection Handling - Full cursor and selection support
- Actions - Drag handles and custom actions
Related
Heading Blocks
Learn about heading blocks
Rich Text API
AppFlowyRichText API reference