Quickstart
Get up and running with Tiptap in just a few minutes. This guide will walk you through creating a basic editor with common formatting options.Make sure you’ve installed Tiptap before following this guide.
Basic Setup
Let’s create a simple editor with the starter kit. Choose your framework below:- React
- Vue 3
- Vanilla JS
Create the Editor
Here’s a minimal React example using Tiptap:What’s Happening?
Import the necessary packages
useEditor- A React hook to create and manage the editor instanceEditorContent- A React component that renders the editorStarterKit- A bundle of essential extensions
Initialize the editor with useEditor
The
useEditor hook takes a configuration object with:extensions- Array of extensions to enablecontent- Initial HTML content for the editor
Complete Example with Toolbar
Here’s a more complete example with a formatting toolbar (fromdemos/src/Examples/Default/React/index.tsx):Cleanup
Always destroy the editor when the component unmounts to prevent memory leaks. TheuseEditor hook handles this automatically.Understanding Commands
Tiptap uses a chainable command API to modify the editor content:Common Commands
| Command | Description |
|---|---|
toggleBold() | Toggle bold formatting |
toggleItalic() | Toggle italic formatting |
toggleStrike() | Toggle strikethrough |
toggleCode() | Toggle inline code |
toggleHeading({ level }) | Toggle heading (1-6) |
toggleBulletList() | Toggle bullet list |
toggleOrderedList() | Toggle ordered list |
toggleCodeBlock() | Toggle code block |
toggleBlockquote() | Toggle blockquote |
setHardBreak() | Insert line break |
undo() | Undo last change |
redo() | Redo last undone change |
Checking Active States
UseisActive() to check if a formatting option is currently active:
Getting and Setting Content
Get Content
Set Content
Styling the Editor
Tiptap doesn’t include default styles. Add your own CSS to style the editor:Next Steps
Now that you have a working editor, explore more features:Add More Extensions
Browse and add more extensions like images, tables, and mentions
Create Custom Extensions
Learn how to build your own custom extensions
Add Collaboration
Enable real-time collaborative editing with Yjs
Explore Examples
See Tiptap in action with interactive examples
Need help? Join the Discord community or check out GitHub Discussions.