Notion-like
The Notion-like editor supports collaborative block editing, writing assistance, emoji, and drag-and-drop reordering. The CLI copies its components into your project.
Start plan required
The Notion-like template requires at least a Start plan subscription to use in production. You can integrate and test it during your trial period. Usage of this template is subject to our Terms of Service and Pro License.
Installation
Sign in with a Tiptap account that has access to the template. The CLI uses your account to download the template and its private packages.
npx @tiptap/cli@latest loginFor existing projects
npx @tiptap/cli@latest add notion-like-editorFor new projects
npx @tiptap/cli@latest init notion-like-editorStyling
Load the shared variables and animations in your global stylesheet. Style setup
Configuration
The editor needs credentials for both Collaboration and writing assistance. The installed lib/tiptap-collab-utils.ts reads the following Next.js variables. In Vite, adapt that helper to read import.meta.env.VITE_* for each public value.
Environment variables
| Variable | Value |
|---|---|
NEXT_PUBLIC_TIPTAP_COLLAB_APP_ID | Your Tiptap Collaboration app ID. |
NEXT_PUBLIC_TIPTAP_AI_APP_ID | Your writing assistance app ID. |
NEXT_PUBLIC_TIPTAP_COLLAB_TOKEN | A short-lived example Collaboration JWT for local development. |
NEXT_PUBLIC_TIPTAP_AI_TOKEN | A short-lived example writing assistance JWT for local development. |
NEXT_PUBLIC_TIPTAP_COLLAB_DOC_PREFIX | An optional prefix for document names. |
JWT authentication
For production, set NEXT_PUBLIC_USE_JWT_TOKEN_API_ENDPOINT=true and implement POST /api/collaboration and POST /api/ai in your app. Each endpoint checks the user's session and access, signs a short-lived JWT with the corresponding server-side secret, and returns JSON with a token field. For local development with example tokens, leave the switch unset. JWT authentication
room prop
Use a stable room ID per document. Give collaborators editing the same document the same room ID.
Image uploads
The demo upload handler in lib/tiptap-utils.ts returns a placeholder. To keep the user's image, implement an upload endpoint that stores the file and responds with its URL. The example below sends multipart form data under file to /api/images and expects JSON with a url field.
For Amazon S3, install @aws-sdk/client-s3 and give your Node.js server permission to write to the bucket. In the endpoint, check the user's access, file type, and size before calling this helper. Pass the base URL where the browser can read the stored images.
import { randomUUID } from 'node:crypto'
import { PutObjectCommand, S3Client } from '@aws-sdk/client-s3'
const storage = new S3Client({})
export async function storeImage(file: File, bucket: string, publicBase: URL) {
const key = `editor-images/${randomUUID()}`
await storage.send(
new PutObjectCommand({
Bucket: bucket,
Key: key,
Body: new Uint8Array(await file.arrayBuffer()),
ContentType: file.type,
}),
)
// Keep the last path segment of the base, for example /uploads.
const base = new URL(publicBase)
if (!base.pathname.endsWith('/')) base.pathname += '/'
return Response.json({ url: new URL(key, base).href })
}Keep the existing file checks in handleImageUpload. The rest of the handler can send the file and return its URL.
const body = new FormData()
body.append('file', file)
const response = await fetch('/api/images', {
method: 'POST',
body,
signal: abortSignal,
})
if (!response.ok) {
throw new Error('Image upload failed')
}
const { url } = await response.json()
if (typeof url !== 'string' || !url) {
throw new Error('The upload endpoint did not return an image URL')
}
onProgress?.({ progress: 100 })
return urlUsage
The generated Next.js page is available at /notion-like. To use the editor on your own route, pass the document ID as its room.
import { NotionEditor } from '@/components/tiptap-templates/notion-like/notion-like-editor'
export default function App() {
return <NotionEditor room="my-document-room" placeholder="Start writing..." />
}Features
- Move blocks with the drag handle, or use the slash menu to insert headings, lists, tables, dividers, and math.
- Format the selection with the floating toolbar, including marks, text color, highlights, links, and alignment.
- Open the mention and emoji menus, insert images, and use the writing menu to revise a selection.
- Edit with other participants and see their carets. The toolbar supports undo and redo.
- Switch between light and dark themes. The toolbar adjusts to the available screen width.
Component breakdown
Hooks
use-cursor-visibilityuse-floating-toolbar-visibilityuse-is-breakpointuse-tiptap-editoruse-ui-editor-stateuse-window-size
Icons
arrow-left-iconchevron-right-iconexternal-link-iconhighlighter-iconlink-iconmoon-star-icon,sun-iconmore-vertical-iconpaint-bucket-iconrepeat-2-icon
Tiptap extensions
The template configures the collaboration and collaboration-caret extensions with a shared Yjs document, and the Ai extension from @tiptap-pro/extension-ai for writing assistance. It also uses StarterKit and the emoji, mention, mathematics, unique ID, placeholder, selection, typography, text style, color, highlight, text align, subscript, superscript, and task list extensions.
The CLI installs these extensions with the template:
ui-state-extensionindent-extensionlist-normalization-extensionnode-alignment-extension,node-background-extensiontriple-click-block-selection-extension
Libs
tiptap-utilstiptap-collab-utils
UI components
ai-ask-button,ai-menu,improve-dropdownblockquote-buttoncode-block-buttoncolor-highlight-button,color-highlight-popovercolor-text-button,color-text-popovercopy-anchor-link-button,copy-to-clipboard-buttondelete-node-button,duplicate-button,move-node-buttondrag-context-menuemoji-dropdown-menuheading-button,heading-dropdown-menuimage-upload-buttonindent-buttonlink-popoverlist-button,list-dropdown-menumark-buttonmention-dropdown-menureset-all-formatting-buttonslash-command-trigger-button,slash-dropdown-menutext-align-buttonturn-into-dropdownundo-redo-button
Nodes
blockquote-nodecode-block-nodeheading-nodehorizontal-rule-nodeimage-node,image-node-pro,image-upload-nodelist-nodeparagraph-nodetable-nodetoc-node
Primitives
avatarbutton,button-groupdropdown-menupopoverseparator,spacer,toolbar
Utilities
floating-element
Contexts
ai-contextuser-contextcollab-context
Collaboration
The collaboration provider connects each participant to the shared Yjs document for their room. Yjs merges concurrent changes. The caret extension shows participants' positions.
<NotionEditor room="team-notes" placeholder="Share your ideas..." />AI integration
The writing menu can generate content from a prompt and revise a selection. Configure the app ID and token before opening the editor. Basic AI Generation extension