Skip to main content

Custom Nodes

Nodes are the building blocks for block-level content in Tiptap. They represent things like paragraphs, headings, blockquotes, code blocks, and more. Each node can have attributes, content rules, and custom rendering.

Understanding Nodes

The Node class extends the Extendable class and provides specific functionality for block-level content.
Source: packages/core/src/Node.ts:340

Creating a Simple Node

Let’s start with a simple paragraph node.
Source: packages/extension-paragraph/src/paragraph.ts:41

Node with Attributes

Here’s a heading node that demonstrates attributes.
Source: packages/extension-heading/src/heading.ts:47

Wrapping Nodes

Some nodes wrap other content, like blockquotes.
Source: packages/extension-blockquote/src/blockquote.tsx:41

Content Expressions

Content expressions define what content a node can contain.
Source: packages/core/src/Node.ts:32

Node Groups

Groups allow you to reference multiple node types in content expressions.
Source: packages/core/src/Node.ts:72

Node Attributes

Attributes store data on nodes and control rendering.
Source: packages/core/src/Node.ts:323

Node Properties

Nodes have several important properties that control their behavior.
Source: packages/core/src/Node.ts:25

Input Rules

Input rules allow you to trigger node creation from text patterns.

TypeScript Commands

Add type-safe commands to your node.
Source: packages/extension-heading/src/heading.ts:24

Extending Nodes

You can extend existing nodes to customize behavior.
Source: packages/core/src/Node.ts:357
Nodes must have unique names within the schema. Make sure your custom node name doesn’t conflict with built-in nodes.

Next Steps

Custom Marks

Create custom inline formatting

Custom Extensions

Add editor-wide functionality