Installation
Install the packages
Install the React package along with the core package and any extensions you need:
Core Concepts
useEditor Hook
TheuseEditor hook is the primary way to create and manage an editor instance in React. It handles the editor lifecycle automatically.
Type Signature
Basic Usage
SSR Configuration
For server-side rendering (Next.js, Remix, etc.), you must setimmediatelyRender to false:
Performance Optimization
For better performance, disable transaction re-renders and useuseEditorState instead:
EditorContent Component
TheEditorContent component renders the actual editor interface.
Usage Example
New Tiptap Component API
Tiptap 3.18+ introduces a new component-based API that provides a cleaner, more React-idiomatic way to build editors.Tiptap Provider Component
TheTiptap component provides the editor instance via context, making it available to all child components.
useTiptap Hook
Access the editor instance from any component inside theTiptap provider:
useTiptapState Hook
Select specific editor state slices for optimized re-renders:Complete Working Example
Event Handlers
Handle editor events through theuseEditor options:
Dependencies Array
The second parameter ofuseEditor accepts a dependencies array, similar to useEffect. When dependencies change, the editor is recreated:
TypeScript Support
Tiptap has full TypeScript support with comprehensive type definitions:Advanced: Custom Node Views
Create React components as custom node views:Menus
Bubble and floating menus are now separate imports to keep@floating-ui/dom optional:
Next Steps
Extensions
Explore available extensions to enhance your editor
Commands
Learn about editor commands and chains
Styling
Customize the editor’s appearance
Node Views
Create interactive custom nodes