Skip to content

Commit

Permalink
add docs for contentDOMElementTag
Browse files Browse the repository at this point in the history
  • Loading branch information
bdbch committed Nov 2, 2023
1 parent 252acb3 commit 6135f43
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions docs/guide/node-views/react.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,24 @@ Keep in mind that this content is rendered by Tiptap. That means you need to tel

The `NodeViewWrapper` and `NodeViewContent` components render a `<div>` HTML tag (`<span>` for inline nodes), but you can change that. For example `<NodeViewContent as="p">` should render a paragraph. One limitation though: That tag must not change during runtime.

## Changing the wrapping DOM element

To change the wrapping DOM elements tag, you can use the `contentDOMElementTag` option on the `ReactNodeViewRenderer` function to change the default tag name.

```js
import { Node } from '@tiptap/core'
import { ReactNodeViewRenderer } from '@tiptap/react'
import Component from './Component.jsx'

export default Node.create({
// configuration …

addNodeView() {
return ReactNodeViewRenderer(Component, { contentDOMElementTag: 'main' })
},
})
```

## All available props
Here is the full list of what props you can expect:

Expand Down

0 comments on commit 6135f43

Please sign in to comment.