Skip to content

Type Editor


Type Editor / @type-editor/tables / commands/toggle-header / toggleHeader

Function: toggleHeader()

ts
function toggleHeader(type, options?): Command;

Defined in: tables/src/commands/toggle-header.ts:52

Toggles between row/column header and normal cells.

The behavior depends on the type parameter:

  • 'row': Toggles the first row between header and regular cells
  • 'column': Toggles the first column between header and regular cells
  • 'cell': Toggles the currently selected cells

When useSelectedRowColumn is true and type is 'row' or 'column', the command toggles the selected row/column instead of the first one.

Parameters

ParameterTypeDescription
typeToggleHeaderTypeThe type of header to toggle: 'column', 'row', or 'cell'
optionsToggleHeaderOptionsOptional configuration object

Returns

Command

A ProseMirror command that toggles headers

Examples

ts
// Toggle first row as header
toggleHeader("row");
ts
// Toggle selected column as header
toggleHeader("column", { useSelectedRowColumn: true });