tiptap/docs/api/nodes/table-header.md
2021-11-09 11:56:27 +01:00

40 lines
1.3 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
description: "Tables dont require a header, but lets be honest: They look better with it."
icon: t-box-line
---
# TableHeader
[![Version](https://img.shields.io/npm/v/@tiptap/extension-table-header.svg?label=version)](https://www.npmjs.com/package/@tiptap/extension-table-header)
[![Downloads](https://img.shields.io/npm/dm/@tiptap/extension-table-header.svg)](https://npmcharts.com/compare/@tiptap/extension-table-header?minimal=true)
Table headers are optional. But come on, you want them, dont you? If you dont want them, update the `content` attribute of the [`TableRow`](/api/nodes/table-row) extension, like this:
```js
// Table rows without table headers
TableRow.extend({
content: 'tableCell*',
})
```
This is the default, which allows table headers:
```js
// Table rows with table headers (default)
TableRow.extend({
content: '(tableCell | tableHeader)*',
})
```
## Installation
```bash
npm install @tiptap/extension-table @tiptap/extension-table-row @tiptap/extension-table-header @tiptap/extension-table-cell
```
This extension requires the [`Table`](/api/nodes/table), [`TableRow`](/api/nodes/table-row) and [`TableCell`](/api/nodes/table-cell) nodes.
## Source code
[packages/extension-table-header/](https://github.com/ueberdosis/tiptap/blob/main/packages/extension-table-header/)
## Usage
https://embed.tiptap.dev/preview/Nodes/Table