TableHeader extension
This extension complements the Table
extension and adds… you guessed it… table headers to them.
Install
npm install @tiptap/extension-table
This extension requires the Table
extension to be installed.
This extension is installed by default with the TableKit
extension, so you don’t need to install it separately.
import { Editor } from '@tiptap/core'
import { TableKit } from '@tiptap/extension-table'
new Editor({
extensions: [TableKit],
})
Usage
Table headers are optional. But come on, you want them, don’t you? If you don’t want them, update the content
attribute of the TableRow
extension, like this:
// Table rows without table headers
TableRow.extend({
content: 'tableCell*',
})
This is the default, which allows table headers:
// Table rows with table headers (default)
TableRow.extend({
content: '(tableCell | tableHeader)*',
})
Source code
packages/extension-table-header/
Minimal Install
import { Editor } from '@tiptap/core'
import { TableHeader } from '@tiptap/extension-table/header'
new Editor({
extensions: [TableHeader],
})