Get it
/
399
Sponsor

Simple Document Editor

A Google Docs-style document editor for React built on Tiptap and shadcn/ui, with a floating toolbar, tables, images, Markdown import and export, and word count.

A document page: a breadcrumb header with collaborators, a floating toolbar, and a paper-style page with a large editable title. The toolbar covers text styles, fonts, text and highlight colors, superscript and subscript, lists with indent and outdent, alignment, and an Insert menu for images, tables, quotes, code blocks and dividers. The header menu imports, exports and copies the document as Markdown. A status bar shows word count, reading time and keyboard shortcuts.

Open in new tab
0 words0 characters

Installation

$ pnpm dlx shadcn@latest add "https://www.rtecn.space/r/simple-document-editor.json"

The CLI also installs the Image Placeholder, Table, Markdown, Paste Cleanup and Code Block extensions. Your project needs Tailwind CSS and shadcn/ui; see the template requirements.

Usage

import { SimpleDocumentEditor } from "@/components/templates/simple-document-editor";
 
export const Doc = ({ doc }) => (
  <SimpleDocumentEditor
    initialTitle={doc.title}
    initialContent={doc.content}
    onChange={(content) => saveDocument(doc.id, content)}
    onTitleChange={(title) => renameDocument(doc.id, title)}
    onShare={() => openShareDialog(doc.id)}
  />
);

Props

PropTypeDescription
initialContentContentTiptap JSON or HTML to start with
initialTitlestringTitle for the breadcrumb and page
onChangefunctionGets the document as Tiptap JSON
onTitleChangefunctionGets the new title
onSharefunctionShows a Share button when set
collaboratorsDocumentCollaborator[]Avatars in the header
pathstring[]Breadcrumb segments before the title
classNamestringOuter container classes

More templates