Fumadocs Editor

Read-only

Show a document without letting it change

editable={false} shows the document read-only:

  • no typing, and no mutating chrome (slash menu, bubble and block menus, joystick)
  • selection and copy still work
  • the raw MDX tab is read-only too

The prop is live: flipping it does not remount the editor. It is a plain TipTap passthrough and has no opinion about why: a viewer role, a published snapshot, a document checked out by someone else.

Wiring it to auth

The auth layer enforces scopes on the server and reports them: the file's read reply carries writable, and sync.onOpen hands it to you. Connecting that to editable is your code:

scoped-editor.tsx
import { useState } from "react";
import { MdxEditor } from "@fumadocs-editor/ui";

export function ScopedEditor({ path }: { path: string }) {
  const [writable, setWritable] = useState(true);
  return (
    <MdxEditor
      sync={{
        path,
        // `writable` comes from the server's scope. Wire it into `editable` here.
        onOpen: (result) => setWritable(result.writable ?? true),
      }}
      editable={writable}
    />
  );
}

onOpen fires the same way with collab on.

Not a security boundary

A read-only user who tampers with the client and types anyway changes nothing: the server refuses the writes. Under collab, their updates are dropped while they keep receiving everyone else's. editable is UI, not enforcement.

Last updated on

On this page