Fumadocs Editor

Read-only

Show a document without letting it change

editable={false} makes the editor read-only:

  • no typing, no slash menu, no block menus
  • selection and copy still work
  • the MDX source tab is read-only too

You can flip it at any time without remounting the editor.

With auth

When the server's scope denies write, sync.onOpen reports writable: false. Pass it to editable:

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,
        onOpen: (result) => setWritable(result.writable),
      }}
      editable={writable}
    />
  );
}

Not a security boundary

editable only changes the UI. The server refuses writes from a read-only user even if they tamper with the client.

Last updated on

On this page