Overview
Table blocks provide a structured way to organize data in rows and columns. They support dynamic resizing, cell selection, row/column management, and rich text content within cells.Block Keys
Table Block Keys
Table Cell Keys
/lib/src/editor/block_component/table_block_component/table_block_component.dart:7
Table Structure
Tables are composed of:- Table Node - Container with table attributes
- Cell Nodes - Individual cells with position data
- Cell Content - Paragraph nodes inside each cell
Creating Tables
Using TableNode Helper
Creating Table Cells
/lib/src/editor/block_component/table_block_component/table_cell_block_component.dart:30
Manual Table Creation
Table Styling
TableStyle Configuration
- Column Width: 160px
- Row Height: 40px
- Minimum Column Width: 40px
- Border Width: 2px
- Border Color: Grey
- Border Hover Color: Blue
/lib/src/editor/block_component/table_block_component/table_block_component.dart:27
Component Builder
Create a table component with custom styling:/lib/src/editor/block_component/table_block_component/table_block_component.dart:80
Using in Editor
Add table support to your editor:Inserting Tables
Using Slash Menu
/lib/src/editor/block_component/table_block_component/table_block_component.dart:345
Programmatic Insertion
Table Operations
Add Row
Add Column
Delete Row
Delete Column
Cell Styling
Background Colors
/lib/src/editor/block_component/table_block_component/table_cell_block_component.dart:119
Custom Cell Colors
Column Resizing
Row Height
Navigation
Cell Navigation
Table Commands
AppFlowy Editor includes built-in table commands:- Tab - Navigate to next cell
- Shift+Tab - Navigate to previous cell
- Enter - New line in cell
- Backspace - Delete in cell (special handling)
Validation
Table validation ensures structure integrity:/lib/src/editor/block_component/table_block_component/table_block_component.dart:118
Scrollable Tables
Tables are wrapped in a horizontal scrollbar:/lib/src/editor/block_component/table_block_component/table_block_component.dart:230
Key Features
- Dynamic Sizing - Resizable columns and rows
- Rich Text Cells - Full paragraph formatting in cells
- Row/Column Operations - Add, delete, reorder
- Cell Styling - Background colors per row/column
- Keyboard Navigation - Tab, arrow keys, shortcuts
- Selection Support - Block and text selection
- Scrollable - Horizontal scroll for wide tables
- Validation - Ensures structural integrity
- Custom Menus - Context menus for operations
Best Practices
- Start small - Begin with 2-3 columns
- Keep content concise - Tables are for structured data
- Use headers - Style first row as header
- Consistent widths - Maintain uniform column widths
- Adequate spacing - Don’t crowd content
- Test navigation - Ensure keyboard navigation works
- Consider mobile - Tables may not render well on small screens
Accessibility
- Keyboard navigation fully supported
- Screen readers can navigate table structure
- Proper semantic roles for table elements
- Selection indicators are clear
Related
Custom Blocks
Create custom block components
Paragraph Blocks
Cell content uses paragraphs