Skip to content
Uxelith
Prov1.0.0App screens

Rich Text Editor

A Notion-style editor on Tiptap: slash menu, Markdown shortcuts, drag-and-drop blocks, tables, images, @mentions, comment threads beside the text and Ask AI from your own model, with JSON, HTML or Markdown out.

Installs with Uxelith ProHow
Licence
Pro
Packages
14
Updated
12 Nov 2026
Live

Installation

Usage

example.tsx
"use client"

import { useState } from "react"
import { RichTextEditor, type JSONContent, type RichTextThread } from "@/components/rich-text-editor"

const me = { id: "u1", name: "Elena Novak" }

export function NotesPage() {
  const [doc, setDoc] = useState<JSONContent | string>("<h2>Launch notes</h2><p>Type / for blocks, or select text to comment.</p>")
  const [threads, setThreads] = useState<RichTextThread[]>([])

  return (
    <RichTextEditor
      className="h-[40rem]"
      defaultTitle="Launch notes"
      value={doc}
      onChange={(json, output) => {
        setDoc(json)
        // Store the JSON to edit later; output.html() and output.markdown() are there for publishing.
        void fetch("/api/notes/launch", { method: "PUT", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ json, markdown: output.markdown() }) })
      }}
      user={me}
      mentions={[me, { id: "u2", name: "Mateo Rossi" }]}
      threads={threads}
      onThreadsChange={(next) => setThreads(next)}
      onAI={async function* (request, { signal }) {
        // Your route calls your model (Claude, OpenAI, anything) and streams text back.
        const response = await fetch("/api/ai", { method: "POST", body: JSON.stringify(request), signal })
        const reader = response.body!.pipeThrough(new TextDecoderStream()).getReader()
        for (;;) {
          const { done, value } = await reader.read()
          if (done) return
          yield value
        }
      }}
      onImageUpload={async (file, { signal }) => {
        const body = new FormData()
        body.append("file", file)
        const response = await fetch("/api/upload", { method: "POST", body, signal })
        const { url } = (await response.json()) as { url: string }
        return url
      }}
    />
  )
}

Props

PropTypeDefaultDescription
value / defaultValueJSONContent | string""The document, as Tiptap JSON or an HTML string. Pass back the JSON onChange gives you.
onChange(json, { html, markdown, text }) => void—Every edit: the document as JSON, with functions that turn it into HTML, Markdown or plain text when you need them.
title / defaultTitle / onTitleChangestring—A title field above the document. Leave both out for no title.
placeholderstring"Write, or press “/” for commands…"Shown in an empty line.
mentionsRichTextPerson[][]People offered after "@": { id, name, color?, avatar? }.
userRichTextPerson—Who is writing. Turns on commenting; without it threads are shown read-only.
threads / defaultThreads / onThreadsChangeRichTextThread[][]Comment threads: { id, quote, resolved?, comments }. Every add, reply, resolve and delete arrives in onThreadsChange with what changed. The highlighted text lives in the document, so save both.
onAI(request, { signal }) => Promise<string> | AsyncIterable<string>—Turns on Ask AI. The request has the action (improve, shorter, translate, continue, summarise, ask…), the selection and the whole document as Markdown. Return Markdown, all at once or streamed.
onImageUpload(file, { signal, onProgress }) => Promise<string>—Uploads pasted, dropped and chosen images and resolves to their URL. Without it, images are added by address.
editablebooleantruefalse shows the document read-only.
statusBar / statusboolean / ReactNodetrue / —The word count, reading time and comments switch along the bottom, and your own status beside them (such as "Saved").
commentsbooleantrueCommenting and the comments panel. false hides both, even with a user.
defaultCommentsOpenbooleantrueWhether the comments panel starts open.
labelstring"Document"Accessible name of the document.

Accessibility

  • The document is a multi-line text box with its own name; every block, mark and table works from the keyboard, and Markdown shortcuts work as you type.
  • The "/" and "@" lists follow the combobox pattern: focus stays in the text, the arrow keys move, Enter or Tab chooses and Escape closes, and the highlighted option is announced.
  • Alt F10 moves focus into the selection toolbar, where the arrow keys move between buttons and Escape returns to the text. Shortcuts: Cmd or Ctrl B, I, U, K for a link, J for Ask AI and Alt M to comment.
  • Dragging is never required: Cmd or Ctrl Shift Up and Down move a block, and the block menu (Enter on the handle) has Move up, Move down, Duplicate, Delete and Turn into.
  • Comments are a labelled region of articles; replies send on Enter, deleting a thread asks first, and AI answers and upload progress are announced politely.
  • Under prefers-reduced-motion nothing fades or pulses.

Changelog

  1. v1.0.0Latest

    First release.

More in App screens

All 8 in App screens
  • App screensPro

    Comment Thread

    Replies, emoji reactions, @mentions with suggestions, who is typing, comments that show the moment they are sent, and a thread you can resolve. Works with any server.

  • App screensPro

    Dashboard Shell

    An application frame: a sidebar that folds to an icon rail, a search that grows into a ⌘K command palette, stats with sparklines, a dense revenue chart with a 7/30/90-day range and recent orders with status badges.

  • App screensPro

    File Manager

    A file manager for your own storage: lasso and multi-select, drag to folders or the Trash, right-click menus, rename in place, Quick Look, Undo and uploads with progress, all by keyboard and touch too.