# React code editor libraries

React code editor libraries embed a code editing surface with syntax highlighting in a React application. Most wrap an existing editor engine such as Monaco, CodeMirror, or Ace and expose its instance through props and callbacks. These libraries let developer tools, playgrounds, and admin consoles accept code from users.

## Popularity

| Library | Monthly downloads | Stars | Last release | License |
| --- | --- | --- | --- | --- |
| [@monaco-editor/react](#monaco-react) | 38.6M | 4.8K | Feb 2025 | MIT |
| [@uiw/react-codemirror](#react-codemirror) | 27.3M | 2.3K | Sep 2026 | MIT |
| [@codesandbox/sandpack-react](#codesandbox-sandpack-react) | 6.6M | 6.3K | Feb 2025 | Apache-2.0 |
| [react-simple-code-editor](#react-simple-code-editor) | 5.3M | 1.7K | Jul 2024 | MIT |
| [react-ace](#react-ace) | 3.5M | 4.2K | Jul 2026 | MIT |
| [react-live](#react-live) | 2.6M | 4.6K | Oct 2026 | MIT |
| [react-codemirror2](#react-codemirrortwo) | 1.7M | 1.7K | Oct 2025 | MIT |
| [react-monaco-editor](#react-monaco-editor) | 1.3M | 4.2K | Jul 2025 | MIT |

Downloads: npm, last thirty days. Stars and releases: GitHub. Amber: no release in over a year.

[@monaco-editor/react](#monaco-react) has the most monthly downloads in this comparison, at 38.6M.

## Capabilities

| Library | Diff editor component | Running code preview | File explorer component |
| --- | --- | --- | --- |
| [@monaco-editor/react](#monaco-react) | Yes | No | No |
| [@uiw/react-codemirror](#react-codemirror) | No | No | No |
| [@codesandbox/sandpack-react](#codesandbox-sandpack-react) | No | Yes | Yes |
| [react-simple-code-editor](#react-simple-code-editor) | No | No | No |
| [react-ace](#react-ace) | Yes | No | No |
| [react-live](#react-live) | No | Yes | No |
| [react-codemirror2](#react-codemirrortwo) | No | No | No |
| [react-monaco-editor](#react-monaco-editor) | Yes | No | No |

## Libraries

### @monaco-editor/react

[GitHub](https://github.com/suren-atoyan/monaco-react) · [npm](https://www.npmjs.com/package/@monaco-editor/react) · [Docs](https://github.com/suren-atoyan/monaco-react/blob/master/README.md)

Embeds Monaco editors with React props, model paths, and native editor callbacks.

- Downloads / mo: 38.6M
- Stars: 4.8K
- Last release: 4.7.0
- License: MIT
- Capabilities: [From the @monaco-editor/react docs](https://github.com/suren-atoyan/monaco-react/blob/master/README.md)

**Strengths**

- **Preserves models between files.** Switch path to restore a file’s model and view state.
- **Exposes the native editor.** Use onMount to retain the editor instance for later commands.

**Watch out for**

- **Loads engine files remotely.** Configure local Monaco files when the default CDN is unavailable.
- **Hook initialization is asynchronous.** Wait for useMonaco to return an instance before calling editor APIs.

```sh
npm install @monaco-editor/react
```

**cloudflare/cloudflare-os** (11.8K stars)

[cloudflare/cloudflare-os](https://github.com/cloudflare/cloudflare-os) 

```javascript
export default function CodeEditor({ filename, ytext, isReady, height = '100%' }: CodeEditorProps) {
  const { resolvedThemeMode } = useTheme()
  const codeTheme = getGadgetsCodeTheme(resolvedThemeMode)
  const editorRef = useRef<editor.IStandaloneCodeEditor | null>(null)
  const monacoRef = useRef<typeof import('monaco-editor') | null>(null)
  const bindingRef = useRef<MonacoBinding | null>(null)
  const [editorReady, setEditorReady] = useState(false)

  // Set up Monaco binding when editor and ytext are available.
  // When ytext is transiently null (e.g., streaming doc rebuild), the binding
  // is detached but the Monaco editor stays mounted — no blank flash.
  useEffect(() => {
    const ed = editorRef.current
    const monaco = monacoRef.current

    if (!ed || !monaco || !ytext || !editorReady) {
      return
    }

    // Get or create a model for this file
    const model = ed.getModel()
    if (!model) {
      return
    }

    // Create the binding between Y.Text and Monaco
    // The binding will sync the Y.Text content to the Monaco model
    const binding = new MonacoBinding(
      ytext,
      model,
      new Set([ed])
    )
    bindingRef.current = binding

    return () => {
      // Clean up binding when component unmounts or ytext changes
      binding.destroy()
      bindingRef.current = null
    }
  }, [ytext, editorReady])

  // Handle editor mount
  const handleEditorDidMount = (editor: editor.IStandaloneCodeEditor, monaco: typeof import('monaco-editor')) => {
    editorRef.current = editor
    monacoRef.current = monaco
    setEditorReady(true)
  }

  if (!filename) {
    return (
      <div
        className="flex justify-center items-center bg-kumo-base text-kumo-subtle"
        style={{ height }}
      >
        Select a file to start editing
      </div>
    )
  }

  return (
    <div style={{ position: 'relative', height }}>
      <Editor
        height="100%"
        language={getLanguage(filename)}
        defaultValue=""
        beforeMount={defineGadgetsCodeTheme}
        onMount={handleEditorDidMount}
        theme={codeTheme}
        options={{
          automaticLayout: true,
          fontSize: 13,
          lineHeight: 20,
          letterSpacing: 0,
          fontFamily: monoFont,
          fontLigatures: false,
          minimap: { enabled: false },
          wordWrap: 'on',
          scrollBeyondLastLine: false,
          renderLineHighlight: 'none',
          selectOnLineNumbers: true,
          roundedSelection: false,
          readOnly: !isReady,
          cursorStyle: 'line',
          autoIndent: 'full',
          formatOnPaste: true,
          formatOnType: true,
          suggest: {
            snippetsPreventQuickSuggestions: false
          },
          tabSize: 2,
          insertSpaces: true,
          folding: true,
          foldingStrategy: 'indentation',
          showFoldingControls: 'mouseover',
          unfoldOnClickAfterEndOfLine: false,
          lineDecorationsWidth: 12,
          lineNumbersMinChars: 4,
          overviewRulerLanes: 0,
          hideCursorInOverviewRuler: true,
          renderWhitespace: 'none',
          guides: {
            indentation: false,
            highlightActiveIndentation: false,
          },
          occurrencesHighlight: 'off',
          selectionHighlight: false,
          scrollbar: {
            verticalScrollbarSize: 10,
            horizontalScrollbarSize: 10,
            useShadows: false,
          },
          contextmenu: true,
          mouseWheelZoom: true
        }}
      />
    </div>
  )
}

```

[packages/workshop-frontend/src/CodeEditor.tsx](https://github.com/cloudflare/cloudflare-os/blob/e1ab8fbd4f609aff7ede9d490bafe1bcf9b2a682/packages/workshop-frontend/src/CodeEditor.tsx#L17-L134) · [More projects using @monaco-editor/react →](https://dashboard.exa.ai/playground/search?q=Projects%20using%20%40monaco-editor/react%20for%20controlled%20React%20code%20editing%20with%20editor%20refs%20and%20callbacks&filters=%7B%22type%22%3A%20%22auto%22%2C%20%22numResults%22%3A%2010%2C%20%22includeDomains%22%3A%20%5B%22github.com%22%5D%7D)

**Quickstart**

```javascript
import Editor from '@monaco-editor/react';

export default function App() {
  return <Editor height="300px" defaultLanguage="javascript" defaultValue="// hello" />;
}

```

From [README.md](https://github.com/suren-atoyan/monaco-react/blob/master/README.md)

### @uiw/react-codemirror

[GitHub](https://github.com/uiwjs/react-codemirror) · [npm](https://www.npmjs.com/package/@uiw/react-codemirror) · [Docs](https://github.com/uiwjs/react-codemirror/blob/master/README.md)

Embeds CodeMirror with React state, extension configuration, and native editor callbacks.

- Downloads / mo: 27.3M
- Stars: 2.3K
- Last release: 4.25.12
- License: MIT
- Capabilities: [From the @uiw/react-codemirror docs](https://github.com/uiwjs/react-codemirror/blob/master/README.md)

**Strengths**

- **Exposes native editor state.** Use onCreateEditor to access the editor view and state.
- **Restores serialized editor state.** Use initialState to restore saved editor state, including configured history fields.

**Watch out for**

- **Changing extensions triggers costly rerenders.** Memoize dynamic extensions to keep their references stable.

```sh
npm install @uiw/react-codemirror
```

**CherryHQ/cherry-studio** (53.6K stars)

[CherryHQ/cherry-studio](https://github.com/CherryHQ/cherry-studio) 

```javascript
const CodeEditor = ({
  ref,
  value,
  placeholder,
  language,
  onSave,
  onChange,
  onBlur,
  onHeightChange,
  height,
  maxHeight,
  minHeight,
  options,
  extensions,
  fontSize: customFontSize,
  style,
  className,
  editable = true,
  readOnly = false,
  expanded = true,
  wrapped = true
}: CodeEditorProps) => {
  const { fontSize: _fontSize, codeShowLineNumbers: _lineNumbers, codeEditor } = useSettings()
  const enableKeymap = useMemo(() => options?.keymap ?? codeEditor.keymap, [options?.keymap, codeEditor.keymap])

  // 合并 codeEditor 和 options 的 basicSetup，options 优先
  const basicSetup = useMemo(() => {
    return {
      lineNumbers: _lineNumbers,
      ...(codeEditor as BasicSetupOptions),
      ...(options as BasicSetupOptions)
    }
  }, [codeEditor, _lineNumbers, options])

  const fontSize = useMemo(() => customFontSize ?? _fontSize - 1, [customFontSize, _fontSize])

  const { activeCmTheme } = useCodeStyle()
  const initialContent = useRef(options?.stream ? (value ?? '').trimEnd() : (value ?? ''))
  const editorViewRef = useRef<EditorView | null>(null)

  const langExtensions = useLanguageExtensions(language, options?.lint)

  const handleSave = useCallback(() => {
    const currentDoc = editorViewRef.current?.state.doc.toString() ?? ''
    onSave?.(currentDoc)
  }, [onSave])

  // Get current content from editor
  const getContent = useCallback(() => {
    return editorViewRef.current?.state.doc.toString() ?? ''
  }, [])

  // 流式响应过程中计算 changes 来更新 EditorView
  // 无法处理用户在流式响应过程中编辑代码的情况（应该也不必处理）
  useEffect(() => {
    if (!editorViewRef.current) return

    const newContent = options?.stream ? (value ?? '').trimEnd() : (value ?? '')
    const currentDoc = editorViewRef.current.state.doc.toString()

    const changes = prepareCodeChanges(currentDoc, newContent)

    if (changes && changes.length > 0) {
      editorViewRef.current.dispatch({
        changes,
        annotations: [External.of(true)]
      })
    }
  }, [options?.stream, value])

  const saveKeymapExtension = useSaveKeymap({ onSave, enabled: enableKeymap })
  const blurExtension = useBlurHandler({ onBlur })
  const heightListenerExtension = useHeightListener({ onHeightChange })

  const customExtensions = useMemo(() => {
    return [
      ...(extensions ?? []),
      ...langExtensions,
      ...(wrapped ? [EditorView.lineWrapping] : []),
      saveKeymapExtension,
      blurExtension,
      heightListenerExtension
    ].flat()
  }, [extensions, langExtensions, wrapped, saveKeymapExtension, blurExtension, heightListenerExtension])

  const scrollToLine = useScrollToLine(editorViewRef)

  useImperativeHandle(
    ref,
    () => ({
      save: handleSave,
      scrollToLine,
      getContent
    }),
    [handleSave, scrollToLine, getContent]
  )

  return (
    <CodeMirror
      // 维持一个稳定值，避免触发 CodeMirror 重置
      value={initialContent.current}
      placeholder={placeholder}
      width="100%"
      height={expanded ? undefined : height}
      maxHeight={expanded ? undefined : maxHeight}
      minHeight={minHeight}
      editable={editable}
      readOnly={readOnly}
      // @ts-ignore 强制使用，见 react-codemirror 的 Example.tsx
      theme={activeCmTheme}
      extensions={customExtensions}
      onCreateEditor={(view: EditorView) => {
        editorViewRef.current = view
        onHeightChange?.(view.scrollDOM?.scrollHeight ?? 0)
      }}
      onChange={(value, viewUpdate) => {
        if (onChange && viewUpdate.docChanged) onChange(value)
      }}
      basicSetup={{
        dropCursor: true,
        allowMultipleSelections: true,
        indentOnInput: true,
        bracketMatching: true,
        closeBrackets: true,
        rectangularSelection: true,
        crosshairCursor: true,
        highlightActiveLineGutter: false,
        highlightSelectionMatches: true,
        closeBracketsKeymap: enableKeymap,
        searchKeymap: enableKeymap,
        foldKeymap: enableKeymap,
        completionKeymap: enableKeymap,
        lintKeymap: enableKeymap,
        ...basicSetup // override basicSetup
      }}
      style={{
        fontSize,
        marginTop: 0,
        borderRadius: 'inherit',
        ...style
      }}
      className={`code-editor ${className ?? ''}`}
    />
  )
}

```

[src/renderer/src/components/CodeEditor/index.tsx](https://github.com/CherryHQ/cherry-studio/blob/101904d03518e601ad2970242b2f29b15219073b/src/renderer/src/components/CodeEditor/index.tsx#L107-L251) · [More projects using @uiw/react-codemirror →](https://dashboard.exa.ai/playground/search?q=Projects%20using%20%40uiw/react-codemirror%20for%20controlled%20React%20code%20editing%20with%20editor%20refs%20and%20callbacks&filters=%7B%22type%22%3A%20%22auto%22%2C%20%22numResults%22%3A%2010%2C%20%22includeDomains%22%3A%20%5B%22github.com%22%5D%7D)

**Quickstart**

```javascript
import { useState } from 'react';
import CodeMirror from '@uiw/react-codemirror';

export default function App() {
  const [code, setCode] = useState('hello');
  return <CodeMirror value={code} height="200px" onChange={setCode} />;
}

```

From [README.md](https://github.com/uiwjs/react-codemirror/blob/master/core/src/index.tsx)

### @codesandbox/sandpack-react

[GitHub](https://github.com/codesandbox/sandpack) · [npm](https://www.npmjs.com/package/@codesandbox/sandpack-react) · [Docs](https://github.com/codesandbox/sandpack/blob/main/README.md)

Provides the Sandpack React components from CodeSandbox.

- Downloads / mo: 6.6M
- Stars: 6.3K
- Last release: 2.20.0
- License: Apache-2.0
- Capabilities: [From the @codesandbox/sandpack-react docs](https://github.com/codesandbox/sandpack/blob/main/README.md)

```sh
npm install @codesandbox/sandpack-react
```

**slab/quill** (47.4K stars)

[slab/quill](https://github.com/slab/quill) 

```jsx
({ files, visibleFiles, activeFile, externalResources }) => {
    const [overrides] = useState(() => {
      if (location.hash.startsWith('#code')) {
        const code = location.hash.replace('#code', '').trim();
        let userCode;
        try {
          userCode = JSON.parse(decompressFromEncodedURIComponent(code));
        } catch (err) {}
        return userCode || {};
      }
      return {};
    });

    return (
      <SandpackProvider
        options={{
          visibleFiles,
          activeFile,
          externalResources:
            externalResources && externalResources.map(replaceCDN),
        }}
        template="static"
        files={Object.keys(files).reduce((f, name) => {
          const fullName = name.startsWith('/') ? name : `/${name}`;
          return {
            ...f,
            [name]: replaceCDN(overrides[fullName] ?? files[name]).trim(),
          };
        }, {})}
      >
        <LocationOverride filenames={Object.keys(files)} />
        <div className={styles.standaloneWrapper}>
          <div className={styles.standaloneFileTree}>
            <SandpackFileExplorer autoHiddenFiles />
          </div>
          <div className={styles.standaloneEditor}>
            <SandpackCodeEditor
              showTabs={false}
              wrapContent
              showRunButton={false}
            />
          </div>
          <div className={styles.standalonePreview}>
            <SandpackPreview showOpenInCodeSandbox={false} />
          </div>
        </div>
      </SandpackProvider>
    );
  }

```

[packages/website/src/components/Sandpack.jsx](https://github.com/slab/quill/blob/539cbffd0a13b18e9c65eb84dd35e6596e403158/packages/website/src/components/Sandpack.jsx#L101-L149) · [More projects using @codesandbox/sandpack-react →](https://dashboard.exa.ai/playground/search?q=%40codesandbox/sandpack-react%20GitHub%20projects)

**Quickstart**

```jsx
import { Sandpack } from '@codesandbox/sandpack-react';

export default function App() {
  return <Sandpack template="react" />;
}

```

From [README.md](https://github.com/codesandbox/sandpack/blob/main/README.md)

### react-simple-code-editor

[GitHub](https://github.com/react-simple-code-editor/react-simple-code-editor) · [npm](https://www.npmjs.com/package/react-simple-code-editor) · [Docs](https://github.com/react-simple-code-editor/react-simple-code-editor/blob/main/README.md)

Provides a controlled code input with an application-supplied syntax highlighter.

- Downloads / mo: 5.3M
- Stars: 1.7K
- Last release: 0.14.1
- License: MIT
- Capabilities: [From the react-simple-code-editor docs](https://github.com/react-simple-code-editor/react-simple-code-editor/blob/main/README.md)

**Strengths**

- **Works as a controlled input.** Pass value and update it through onValueChange.
- **Allows keyboard users to escape.** Set ignoreTabKey or use the shortcut to stop capturing Tab.

**Watch out for**

- **Slows down with large documents.** Large documents can reduce typing speed.
- **Mixed font styles misalign text.** Keep highlighted text aligned with the underlying textarea.

```sh
npm install react-simple-code-editor prismjs
```

**styleguidist/react-styleguidist** (11.0K stars)

[styleguidist/react-styleguidist](https://github.com/styleguidist/react-styleguidist) 

```javascript
public render() {
	return (
		<SimpleEditor
			className={this.props.classes.root}
			value={this.state.code}
			onValueChange={this.handleChange}
			highlight={highlight}
			// Padding should be passed via a prop (not CSS) for a proper
			// cursor position calculation
			padding={space[2]}
		/>
	);
}

```

[src/client/rsg-components/Editor/Editor.tsx](https://github.com/styleguidist/react-styleguidist/blob/c223f9a279f4e872cf6ff925fb21d2a7f6e27a77/src/client/rsg-components/Editor/Editor.tsx#L79-L91) · [More projects using react-simple-code-editor →](https://dashboard.exa.ai/playground/search?q=Projects%20using%20react-simple-code-editor%20for%20controlled%20React%20code%20editing%20with%20editor%20refs%20and%20callbacks&filters=%7B%22type%22%3A%20%22auto%22%2C%20%22numResults%22%3A%2010%2C%20%22includeDomains%22%3A%20%5B%22github.com%22%5D%7D)

**Quickstart**

```javascript
import { useState } from 'react';
import Editor from 'react-simple-code-editor';
import { highlight, languages } from 'prismjs/components/prism-core';
import 'prismjs/components/prism-clike';
import 'prismjs/components/prism-javascript';
import 'prismjs/themes/prism.css';

export default function App() {
  const [code, setCode] = useState('const answer = 42;');
  return <Editor value={code} onValueChange={setCode}
    highlight={value => highlight(value, languages.js)} padding={10} />;
}

```

From [README.md](https://github.com/react-simple-code-editor/react-simple-code-editor/blob/main/README.md)

### react-ace

[GitHub](https://github.com/securingsincity/react-ace) · [npm](https://www.npmjs.com/package/react-ace) · [Docs](https://github.com/securingsincity/react-ace/blob/main/README.md)

Embeds Ace with React props for text, editor options, and event callbacks.

- Downloads / mo: 3.5M
- Stars: 4.2K
- Last release: 15.0.0
- License: MIT
- Capabilities: [From the react-ace docs](https://github.com/securingsincity/react-ace/blob/main/README.md)

**Strengths**

- **Exposes native editor commands.** Use the component’s editor property to run Ace commands.
- **Adds custom keyboard commands.** Pass commands with key bindings and their event handlers.

**Watch out for**

- **Autocomplete needs an extension.** Import language_tools before enabling completions or snippets.

```sh
npm install react-ace ace-builds
```

**spinnaker/deck** (307 stars)

[spinnaker/deck](https://github.com/spinnaker/deck) 

```javascript
public componentDidMount(): void {
  if (this.props.autofocus) {
    const { editor } = this.editorRef.current as any;
    editor.focus();
    editor.navigateFileStart();
  }
}

```

[app/scripts/modules/core/src/presentation/forms/inputs/JsonEditor.tsx](https://github.com/spinnaker/deck/blob/308a9911678a58d167e16df323a96af0e6e5786b/app/scripts/modules/core/src/presentation/forms/inputs/JsonEditor.tsx#L43-L49) · [More projects using react-ace →](https://dashboard.exa.ai/playground/search?q=Projects%20using%20react-ace%20for%20controlled%20React%20code%20editing%20with%20editor%20refs%20and%20callbacks&filters=%7B%22type%22%3A%20%22auto%22%2C%20%22numResults%22%3A%2010%2C%20%22includeDomains%22%3A%20%5B%22github.com%22%5D%7D)

**Quickstart**

```javascript
import AceEditor from 'react-ace';
import 'ace-builds/src-noconflict/mode-java';
import 'ace-builds/src-noconflict/theme-github';

export default function App() {
  return <AceEditor mode="java" theme="github" name="code-input"
    defaultValue="// hello" width="100%" height="200px" />;
}

```

From [README.md](https://github.com/securingsincity/react-ace/blob/main/README.md)

### react-live

[GitHub](https://github.com/FormidableLabs/react-live) · [npm](https://www.npmjs.com/package/react-live) · [Docs](https://github.com/FormidableLabs/react-live/blob/master/README.md)

Provides a production-focused playground for live editing React code.

- Downloads / mo: 2.6M
- Stars: 4.6K
- Last release: 5.0.1
- License: MIT
- Capabilities: [From the react-live docs](https://github.com/FormidableLabs/react-live/blob/master/README.md)

```sh
npm install react-live
```

**meta/docusaurus** (66.8K stars)

[meta/docusaurus](https://github.com/meta/docusaurus) 

```jsx
function LiveProviderComponent({code, children, ...props}: Props): ReactNode {
  const prismTheme = usePrismTheme();
  const noInline = props.metastring?.includes('noInline') ?? false;
  return (
    <LiveProvider
      noInline={noInline}
      theme={prismTheme}
      {...props}
      code={code?.replace(/\n$/, '')}
      transformCode={props.transformCode ?? DEFAULT_TRANSFORM_CODE}>
      {children}
    </LiveProvider>
  );
}

```

[packages/docusaurus-theme-live-codeblock/src/theme/Playground/Provider/index.tsx](https://github.com/meta/docusaurus/blob/2556f711f4c9653bcd6f74ca6acc52eb07b6c6d7/packages/docusaurus-theme-live-codeblock/src/theme/Playground/Provider/index.tsx#L18-L31) · [More projects using react-live →](https://dashboard.exa.ai/playground/search?q=react-live%20GitHub%20projects)

**Quickstart**

```jsx
import { LiveProvider, LiveEditor, LivePreview } from 'react-live';

export default function App() {
  return (
    <LiveProvider code="<strong>Hello</strong>">
      <LiveEditor />
      <LivePreview />
    </LiveProvider>
  );
}

```

From [README.md](https://github.com/FormidableLabs/react-live/blob/master/packages/react-live/src/index.ts)

### react-codemirror2

[GitHub](https://github.com/scniro/react-codemirror2) · [npm](https://www.npmjs.com/package/react-codemirror2) · [Docs](https://github.com/scniro/react-codemirror2/blob/master/README.md)

Wraps CodeMirror in a small React component.

- Downloads / mo: 1.7M
- Stars: 1.7K
- Last release: 9.0.1
- License: MIT
- Capabilities: [From the react-codemirror2 docs](https://github.com/scniro/react-codemirror2/blob/master/README.md)

```sh
npm install react-codemirror2 codemirror@5
```

**decaporg/decap-cms** (19.5K stars)

[decaporg/decap-cms](https://github.com/decaporg/decap-cms) 

```jsx
handleChange(newValue) {
  const cursor = this.cm.doc.getCursor();
  const selections = this.cm.doc.listSelections();
  this.setState({ lastKnownValue: newValue });
  this.props.onChange(this.toValue('code', newValue), { cursor, selections });
}

```

[packages/decap-cms-widget-code/src/CodeControl.js](https://github.com/decaporg/decap-cms/blob/4589962560fcff888596cce6ee9cf6bcfa339764/packages/decap-cms-widget-code/src/CodeControl.js#L246-L251) · [More projects using react-codemirror2 →](https://dashboard.exa.ai/playground/search?q=react-codemirror2%20GitHub%20projects)

**Quickstart**

```jsx
import { useState } from 'react';
import { Controlled as CodeMirror } from 'react-codemirror2';
import 'codemirror/lib/codemirror.css';

export default function App() {
  const [code, setCode] = useState('hello');
  return <CodeMirror value={code}
    onBeforeChange={(_editor, _change, value) => setCode(value)} />;
}

```

From [README.md](https://github.com/scniro/react-codemirror2/blob/master/README.md)

### react-monaco-editor

[GitHub](https://github.com/react-monaco-editor/react-monaco-editor) · [npm](https://www.npmjs.com/package/react-monaco-editor) · [Docs](https://github.com/react-monaco-editor/react-monaco-editor/blob/master/README.md)

Provides Monaco Editor for React.

- Downloads / mo: 1.3M
- Stars: 4.2K
- Last release: 0.59.0
- License: MIT
- Capabilities: [From the react-monaco-editor docs](https://github.com/react-monaco-editor/react-monaco-editor/blob/master/README.md)

```sh
yarn add react-monaco-editor
```

**microsoft/nni** (14.4K stars)

[microsoft/nni](https://github.com/microsoft/nni) 

```jsx
const MonacoHTML = (props: MonacoEditorProps): any => {
    const { content, loading, height } = props;
    return (
        <React.Fragment>
            {loading ? (
                <Spinner
                    label='Wait, wait...'
                    ariaLive='assertive'
                    labelPosition='right'
                    styles={{ root: { width: '100%', height: height } }}
                >
                    <MonacoEditor
                        width='100%'
                        height={height}
                        language='json'
                        value={content}
                        options={{
                            minimap: { enabled: false },
                            readOnly: true,
                            automaticLayout: true,
                            wordWrap: 'on'
                        }}
                    />
                </Spinner>
            ) : (
                <MonacoEditor
                    width='100%'
                    height={height}
                    language='json'
                    value={content}
                    options={{
                        minimap: { enabled: false },
                        readOnly: true,
                        automaticLayout: true,
                        wordWrap: 'on'
                    }}
                />
            )}
        </React.Fragment>
    );
};
```

[ts/webui/src/components/common/MonacoEditor.tsx](https://github.com/microsoft/nni/blob/767ed7f22e1e588ce76cbbecb6c6a4a76a309805/ts/webui/src/components/common/MonacoEditor.tsx#L11-L51) · [More projects using react-monaco-editor →](https://dashboard.exa.ai/playground/search?q=react-monaco-editor%20GitHub%20projects)

**Quickstart**

```jsx
import MonacoEditor from 'react-monaco-editor';

export default function App() {
  return <MonacoEditor height="300" language="javascript" value="// hello" />;
}

```

From [README.md](https://github.com/react-monaco-editor/react-monaco-editor/blob/master/README.md)

## FAQ

### Which React code editor library should I use?

[@monaco-editor/react](#monaco-react) suits multi-file editors that keep a model and view state for each path. [@uiw/react-codemirror](#react-codemirror) suits CodeMirror editors configured through extensions. [react-simple-code-editor](#react-simple-code-editor) suits small controlled inputs with an application-supplied highlighter.

### What is react-live?

[react-live](#react-live) provides a production-focused playground for live editing React code.

### How do I use Ace in React?

[react-ace](#react-ace) embeds Ace with React props for text, editor options, and event callbacks. Autocomplete needs the language_tools extension imported first.

### How do I use Monaco Editor in React?

[@monaco-editor/react](#monaco-react) embeds Monaco editors with React props and native editor callbacks. It loads its engine files from a CDN unless local files are configured.

## How this page was built

Data checked Nov 20, 2026.

Reproduce it with the Exa API:

```json
{
  "endpoint": "/search",
  "body": {
    "query": "Best React code editor libraries Monaco React CodeMirror React Ace react-simple-code-editor code examples",
    "numResults": 5
  }
}
```

Docs: https://exa.ai/docs/reference/search
