PromptsApr 3, 2026·2 min read

Novel — Notion-Style AI Editor Component

WYSIWYG editor with AI autocompletion, slash commands, and bubble menu. Drop into any React app. 16K+ GitHub stars.

TL;DR
Novel is a drop-in React editor with AI autocompletion and slash commands.
§01

What it is

Novel is an open-source WYSIWYG editor component for React that provides a Notion-like editing experience with AI-powered autocompletion. It includes slash commands for inserting blocks, a bubble menu for formatting selections, and an AI completion feature that generates text inline. Built on Tiptap and ProseMirror.

It targets developers building applications that need a rich text editor with a modern, Notion-style interface and optional AI writing assistance.

§02

How it saves time or tokens

Novel provides a production-ready editor component that would take weeks to build from scratch. Instead of configuring Tiptap, building a slash command system, designing a bubble menu, and integrating AI completion, you install Novel and get all of these features. The AI completion connects to your own API endpoint, so you control the model and costs.

§03

How to use

  1. Install the package:
npm install novel
  1. Drop into your React app:
import { Editor } from 'novel';

export default function Page() {
    return (
        <Editor
            defaultValue={initialContent}
            onUpdate={(editor) => {
                console.log(editor.getJSON());
            }}
        />
    );
}
  1. Configure AI completion with your own endpoint:
<Editor
    completionApi="/api/generate"
    defaultValue={initialContent}
/>
§04

Example

import { Editor } from 'novel';
import { useState } from 'react';

export default function DocumentEditor() {
    const [content, setContent] = useState({});
    const [saving, setSaving] = useState(false);
    
    const handleSave = async () => {
        setSaving(true);
        await fetch('/api/documents', {
            method: 'POST',
            headers: { 'Content-Type': 'application/json' },
            body: JSON.stringify({ content })
        });
        setSaving(false);
    };
    
    return (
        <div>
            <button onClick={handleSave}>
                {saving ? 'Saving...' : 'Save'}
            </button>
            <Editor
                completionApi="/api/ai/complete"
                defaultValue={{}}
                onUpdate={(editor) => setContent(editor.getJSON())}
                className="min-h-[500px] border rounded p-4"
            />
        </div>
    );
}
§05

Related on TokRepo

§06

Common pitfalls

  • The AI completion feature requires a server-side API endpoint that streams text. The endpoint must return a ReadableStream for the inline typing effect to work.
  • Novel is built for React. Vue, Svelte, and vanilla JS are not supported directly. For other frameworks, use Tiptap directly.
  • Customizing the editor beyond the provided options requires understanding the underlying Tiptap and ProseMirror architecture.

Frequently Asked Questions

Does Novel require an AI backend?+

No. The AI autocompletion is optional. Novel works as a standard rich text editor without AI features. If you want AI completion, you provide your own API endpoint via the completionApi prop. This endpoint can connect to any LLM provider.

Can I customize the editor appearance?+

Yes. Novel uses Tailwind CSS for styling. You can pass custom className props and override the default styles. The slash command menu, bubble menu, and editor area are all customizable through Tailwind classes or CSS.

What content formats does Novel output?+

Novel outputs content as Tiptap/ProseMirror JSON or HTML. The onUpdate callback provides an editor instance with getJSON() and getHTML() methods. You can store the JSON format for lossless round-tripping or HTML for rendering elsewhere.

How does Novel compare to Notion?+

Novel provides a similar editing experience to Notion -- slash commands, block-based editing, and inline formatting. However, Novel is an embeddable component, not a full application. You integrate it into your own app and handle storage, permissions, and collaboration yourself.

Can I use Novel with Next.js?+

Yes. Novel works with Next.js out of the box. The editor component renders on the client side. For the AI completion feature, create an API route in Next.js that proxies requests to your LLM provider and streams the response back to the editor.

Citations (3)
🙏

Source & Thanks

Created by Steven Tey. Licensed under Apache-2.0.

novel — ⭐ 16,100+

Discussion

Sign in to join the discussion.
No comments yet. Be the first to share your thoughts.