Tiptap is a Rich Text Editor Framework for Vue.js


October 8th, 2018


Tiptap by Philipp Kühn (@philippkuehn) is a renderless and extendable rich-text editor for Vue.js. Where React has slate.js, Tiptap aims to be that style of a framework for Vue.js. The Tiptap readme explains the idea behind the project as follows:

I was looking for a text editor for Vue.js and found some solutions that didn’t satisfy me. The editor should be easy to extend and not based on old dependencies such as jQuery. For React there is already a great editor called Slate.js, which impresses with its modularity. I came across Prosemirror and decided to build on it. Prosemirror is a toolkit for building rich-text editors that are already in use at many well-known companies such as Atlassian or New York Times.

Tiptap is built on top of ProseMirror, which describes itself as “a toolkit for building rich-text editors on the web.”

Under the hood, you can store your data “as raw HTML, or as a JSON-serializable representation of your document.”

Here’s an example of the JSON-serializable output from the component:

2 "type": "doc",
3 "content": [
4 {
5 "type": "heading",
6 "attrs": {
7 "level": 2
8 },
9 "content": [
10 {
11 "type": "text",
12 "text": "Export HTML or JSON"
13 }
14 ]
15 },
16 {
17 "type": "paragraph",
18 "content": [
19 {
20 "type": "text",
21 "text": "Hello from Tiptap."
22 }
23 ]
24 }
25 ]

Here’s the most basic example of using Tiptap in your Vue project:

2 <editor>
3 <!-- Add HTML to the scoped slot called `content` -->
4 <div slot="content" slot-scope="props">
5 <p>Hi, I'm just a boring paragraph</p>
6 </div>
7 </editor>
11// Import the editor
12import { Editor } from 'tiptap'
14export default {
15 components: {
16 Editor,
17 },

To learn more about the editor’s capabilities, check out the live demos available at tiptap.scrumpy.io. The live demo has many examples of ways you can extend the base Tiptap editor component, such as text alignment, suggestions, todo lists, images, links, and a menu bubble after you select some text:

To learn more about Tiptap, check out the GitHub project for details on the editor component props, scoped slots available, and extensions.

Filed in:

Paul Redmond

Full stack web developer. Author of Lumen Programming Guide and Docker for PHP Developers.

Laravel News Partners