Overview
The Table plugin provides a complete solution for creating and managing tables. It includes features for cell selection, merging, splitting, and formatting tabular data.Installation
Basic Usage
Pass the plugin tocreateYooptaEditor; do not pass plugins to <YooptaEditor>.
Features
- Flexible Tables: Create tables of any size
- Cell Operations: Merge, split, insert, delete cells
- Header Rows/Columns: Mark rows and columns as headers
- Cell Alignment: Horizontal and vertical alignment
- Column Resizing: Adjustable column widths
- Cell Selection: Select multiple cells
- Keyboard Shortcuts: Type
table,||, or3x3to insert
Structure
The Table plugin consists of nested elements:Configuration
Options
object
string[]
default:"['table', '||', '3x3']"
Keyboard shortcuts to trigger the plugin
Element Props
table
boolean
default:"false"
Whether the first row should be treated as a header
boolean
default:"false"
Whether the first column should be treated as a header
number[]
default:"[200, 150, 250]"
Array of column widths in pixels
table-data-cell
boolean
default:"false"
Whether this cell should be rendered as a header (th)
'left' | 'center' | 'right'
default:"left"
Horizontal text alignment
'top' | 'middle' | 'bottom'
default:"top"
Vertical text alignment
number
default:"1"
Number of columns this cell spans
number
default:"1"
Number of rows this cell spans
string | null
Cell background color
Commands
buildTableElements
Creates the initial table structure.number
default:"3"
Number of rows to create
number
default:"3"
Number of columns to create
insertRow
Insert a new row at a specific position.insertColumn
Insert a new column at a specific position.deleteRow
Delete a specific row.deleteColumn
Delete a specific column.mergeCells
Merge selected cells into one.splitCell
Split a merged cell.updateCellProps
Update cell properties.clearContents
Clear contents of selected cells.Initial Structure
When created, the plugin initializes with a 3x3 table:Custom Rendering
Parsers
HTML Deserialization
The plugin automatically deserializes<table> tags:
HTML Serialization
Markdown Serialization
Keyboard Behavior
The Table plugin has special keyboard handling:- Tab: Move to next cell
- Shift+Tab: Move to previous cell
- Arrow Keys: Navigate between cells
- Enter: Move to cell below
- Backspace: Delete cell content (not the cell)
Cell Selection
The plugin supports multi-cell selection:Use Cases
Data Tables
Display structured data and statistics
Pricing Tables
Compare pricing plans and features
Schedules
Create timetables and schedules
Comparison Tables
Compare products, services, or features
Best Practices
Use Header Rows
Use Header Rows
Always use header rows for better readability and accessibility
Keep Tables Simple
Keep Tables Simple
Avoid overly complex tables with too many merged cells
Responsive Design
Responsive Design
Consider mobile layouts for wide tables
Consistent Alignment
Consistent Alignment
Use consistent alignment patterns within columns
Add Context
Add Context
Provide table captions or descriptions for context
Styling Examples
Basic CSS
Striped Rows
Bordered Style
Advanced Patterns
With Cell Selection Highlight
With Sortable Columns
Related Plugins
- Paragraph Plugin - For text within cells
- Code Plugin - For code in cells

