Skip to content

Table Plugin

The TablePlugin provides comprehensive table support including a grid picker for insertion, a fully accessible context menu, border color customization, multi-cell selection, interactive visual controls, and complete keyboard navigation.

Table plugin with grid picker

import { TablePlugin } from '@notectl/core';
new TablePlugin()
// or with custom picker size:
new TablePlugin({ maxPickerRows: 10, maxPickerCols: 10 })
interface TableConfig {
/** Maximum rows in grid picker. Default: 8 */
readonly maxPickerRows?: number;
/** Maximum columns in grid picker. Default: 8 */
readonly maxPickerCols?: number;
/** Render separator after toolbar item. */
readonly separatorAfter?: boolean;
/** Locale for all user-facing strings. Defaults to auto-detected language. */
readonly locale?: TableLocale;
}

Each plugin resolves its locale automatically from the editor’s global locale setting. To override the table locale independently:

import { TablePlugin, TABLE_LOCALE_DE } from '@notectl/core';
new TablePlugin({ locale: TABLE_LOCALE_DE })

See the Internationalization guide for details on global and per-plugin locale configuration.

CommandDescriptionReturns
insertTableInsert a table (via grid picker selection)boolean
addRowAboveInsert row above current cellboolean
addRowBelowInsert row below current cellboolean
addColumnLeftInsert column to the left of current cellboolean
addColumnRightInsert column to the right of current cellboolean
deleteRowDelete the row containing the cursorboolean
deleteColumnDelete the column containing the cursorboolean
deleteTableDelete the entire tableboolean
selectTableSelect the entire tableboolean
resetTableBorderColorReset border color to theme defaultboolean
// Insert a table programmatically
editor.executeCommand('insertTable');
// Modify table structure
editor.executeCommand('addRowBelow');
editor.executeCommand('deleteColumn');
// Reset border color
editor.executeCommand('resetTableBorderColor');

Right-click inside any table cell (or press Shift+F10) to open an accessible context menu with all table operations.

Table context menu

The context menu provides:

  • Insert Row Above / Below — add rows relative to the cursor
  • Insert Column Left / Right — add columns relative to the cursor
  • Delete Row / Column — remove the current row or column
  • Border Color — opens a color picker submenu
  • Delete Table — remove the entire table

The context menu is fully keyboard-accessible following WAI-ARIA menu patterns:

KeyAction
ArrowDown / ArrowUpMove focus between menu items
Enter / SpaceActivate the focused item
ArrowRightOpen submenu (on Border Color item)
ArrowLeftClose submenu, return to parent
Home / EndJump to first / last menu item
EscapeClose the menu

Customize table border colors through the context menu or the border color button in the table controls overlay.

Table border color picker

The border color picker provides:

  • Default — reset to the theme’s default border color
  • No borders — remove all visible borders
  • Color grid — 20 subdued, border-appropriate colors (grays, earth tones, muted hues)

The color grid supports full keyboard navigation with arrow keys, Home/End, Enter to select, and Escape to close.

import { TableSelectionServiceKey } from '@notectl/core';
// Reset to default
editor.executeCommand('resetTableBorderColor');

When hovering over a table, interactive overlay controls appear:

  • Column handles — appear above each column. Click to select; each handle has a delete button
  • Row handles — appear to the left of each row. Click to select; each handle has a delete button
  • Add row zone — a button below the table to append a new row
  • Add column zone — a button to the right of the table to append a new column
  • Insert lines — hover between rows or columns to see a blue insert line with a + button. Click to insert a row or column at that position
  • Actions button — opens the context menu
  • Border color button — quick access to the border color picker
  • Delete table button — remove the entire table
ShortcutAction
TabMove to next cell (wraps to next row, adds row at end)
Shift+TabMove to previous cell
EnterMove to cell below
Shift+F10Open context menu
BackspaceDelete content or merge with previous cell
DeleteDelete content or merge with next cell
EscapeExit table selection
Arrow keysNavigate between cells

The table toolbar button shows a grid picker popup. Hover over cells to select the table dimensions (e.g., 3x4), then click to insert. The label updates dynamically to show the current hover dimensions.

TypeHTML TagAttributesDescription
table<table>borderColor?: stringTable container
table_row<tr>-Table row
table_cell<td>colspan?: number, rowspan?: numberTable cell (allows paragraph, list_item, heading, blockquote, image, horizontal_rule)

The table plugin supports selecting multiple cells by click-and-drag. Selected cells are highlighted and can be operated on as a group (e.g., delete all selected cells’ content).

Access the selection service programmatically:

import { TableSelectionServiceKey } from '@notectl/core';
const service = editor.getService(TableSelectionServiceKey);

The table plugin follows WAI-ARIA best practices:

  • Tables are announced with dimensions (e.g., “Table with 3 rows and 4 columns”)
  • A description hint tells screen readers how to access table actions
  • All row/column operations announce their result (e.g., “Row inserted above”)
  • Border color changes are announced (e.g., “Table border color set to Blue”)
  • The context menu uses role="menu" with role="menuitem" for each action
  • The border color grid uses role="grid" with role="gridcell" for each swatch
  • All interactive elements follow roving tabindex patterns

Tables use custom NodeView implementations for:

  • Table wrapper with horizontal scroll support for wide tables
  • Row rendering with proper <tr> element management
  • Cell rendering with editable content areas inside <td> elements