---
title: "insertContent command"
description: "Use the insertContent command in Tiptap to add content to the document using plain text, HTML, or JSON. Learn more in our docs!"
canonical_url: "https://tiptap.dev/docs/editor/api/commands/content/insert-content"
---

# insertContent command

Use the insertContent command in Tiptap to add content to the document using plain text, HTML, or JSON. Learn more in our docs!

The `insertContent` command adds the passed value to the document.

See also: [setContent](https://tiptap.dev/docs/editor/api/commands/content/set-content.md), [clearContent](https://tiptap.dev/docs/editor/api/commands/content/clear-content.md)

## Parameters

`value: Content`

The command is pretty flexible and takes plain text, HTML or even JSON as a value.

## Use the insertContent command

```js
// Plain text
editor.commands.insertContent('Example Text')

// HTML
editor.commands.insertContent('<h1>Example Text</h1>')

// HTML with trim white space
editor.commands.insertContent('<h1>Example Text</h1>', {
  parseOptions: {
    preserveWhitespace: false,
  },
})

// JSON/Nodes
editor.commands.insertContent({
  type: 'heading',
  attrs: {
    level: 1,
  },
  content: [
    {
      type: 'text',
      text: 'Example Text',
    },
  ],
})

// Multiple nodes at once
editor.commands.insertContent([
  {
    type: 'paragraph',
    content: [
      {
        type: 'text',
        text: 'First paragraph',
      },
    ],
  },
  {
    type: 'paragraph',
    content: [
      {
        type: 'text',
        text: 'Second paragraph',
      },
    ],
  },
])
```
