2021-10-14 06:13:50 +08:00
---
description: "Everyone needs it, nobody talks about it: the Document extension."
2021-10-15 03:20:21 +08:00
icon: file-line
2021-10-14 06:13:50 +08:00
---
2020-09-09 21:58:06 +08:00
# Document
2021-01-25 17:35:52 +08:00
[![Version ](https://img.shields.io/npm/v/@tiptap/extension-document.svg?label=version )](https://www.npmjs.com/package/@tiptap/extension-document)
[![Downloads ](https://img.shields.io/npm/dm/@tiptap/extension-document.svg )](https://npmcharts.com/compare/@tiptap/extension-document?minimal=true)
2020-09-09 21:58:06 +08:00
**The `Document` extension is required**, no matter what you build with tiptap. It’ s a so called “topNode”, a node that’ s the home to all other nodes. Think of it like the `<body>` tag for your document.
2021-06-19 16:26:50 +08:00
The node is very tiny though. It defines a name of the node (`doc`), is configured to be a top node (`topNode: true`) and that it can contain multiple other nodes (`block+`). That’ s all. But have a look yourself:
2020-09-09 21:58:06 +08:00
:::warning Breaking Change from 1.x → 2.x
2021-05-07 00:41:22 +08:00
tiptap 1 tried to hide that node from you, but it has always been there. You have to explicitly import it from now on (or use `StarterKit` ).
2020-09-09 21:58:06 +08:00
:::
2020-09-23 15:52:04 +08:00
## Installation
```bash
2020-10-30 21:24:16 +08:00
# with npm
2020-09-23 15:52:04 +08:00
npm install @tiptap/extension -document
2020-10-30 21:24:16 +08:00
# with Yarn
2020-09-23 15:52:04 +08:00
yarn add @tiptap/extension -document
```
2020-09-21 22:59:28 +08:00
## Source code
2021-04-21 21:31:11 +08:00
[packages/extension-document/ ](https://github.com/ueberdosis/tiptap/blob/main/packages/extension-document/ )
2020-09-09 21:58:06 +08:00
## Usage
2021-08-26 05:10:20 +08:00
< tiptap-demo name = "Nodes/Document" > < / tiptap-demo >