# @typefox/monaco-editor-react

> React component for Monaco-Editor and Monaco Languageclient

Latest version **8.0.3** (published 2026-10-15) · MIT license · 0 weekly downloads

## Install

```sh
npm install @typefox/monaco-editor-react
pnpm add @typefox/monaco-editor-react
yarn add @typefox/monaco-editor-react
bun add @typefox/monaco-editor-react
```

## Health

**Score 70/100 (B)** — status: active.

Positive: has types; esm support; no vulnerabilities; has provenance; recently updated; high maintenance score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 8.0.3 |
| Published | 2026-10-15 |
| First published | 2022-12-02 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=22 |
| Dependencies | 4 |
| Unpacked size | 75.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 1375 |
| Author | TypeFox GmbH |
| Maintainers | typefox-team, spoenemann, kaisalmen, msujew, dennis.huebner |
| Keywords | monaco-editor, monaco-languageclient, react, typescript |

## Links

- npm: https://www.npmjs.com/package/@typefox/monaco-editor-react
- Repository: https://github.com/TypeFox/monaco-languageclient
- Homepage: https://github.com/TypeFox/monaco-languageclient/blob/main/packages/wrapper-react/README.md
- Issues: https://github.com/TypeFox/monaco-languageclient/issues
- npm.io page: https://npm.io/package/@typefox/monaco-editor-react

## Dependencies (4)

- [react](https://npm.io/package/react.md) >=18.0.0 || <20.0.0
- [monaco-languageclient](https://npm.io/package/monaco-languageclient.md) ~11.0.3
- [@codingame/monaco-vscode-api](https://npm.io/package/@codingame/monaco-vscode-api.md) ^37.6.0
- [@codingame/monaco-vscode-log-service-override](https://npm.io/package/@codingame/monaco-vscode-log-service-override.md) ^37.6.0

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 8.0.3 (latest) — 2026-10-15
- 8.0.0 (next) — 2026-09-23
- 8.0.2 — 2026-09-24
- 8.0.1 — 2026-09-23
- 8.0.0-next.2 — 2026-09-23
- 8.0.0-next.1 — 2026-07-16
- 8.0.0-next.0 — 2026-07-13
- 7.7.0 — 2026-02-04
- 7.6.0 — 2026-01-14
- 7.5.0 — 2025-12-23
- 7.5.0-next.1 — 2025-12-22
- 7.5.0-next.0 — 2025-12-19
- 7.4.0 — 2025-11-26
- 7.4.0-next.2 — 2025-11-21
- 7.4.0-next.1 — 2025-11-20
- … 145 more at https://npm.io/package/@typefox/monaco-editor-react/versions

## README

# React component for Monaco-Editor and Monaco Languageclient

This package provides a React component that wraps the functionality of [monaco-languageclient](https://www.npmjs.com/package/monaco-languageclient) and all its tools.

## CHANGELOG

All changes are noted in the [CHANGELOG](https://github.com/TypeFox/monaco-languageclient/blob/main/packages/wrapper-react/CHANGELOG.md).

## Official documentation, quick start and examples

This npm package is part of the [monaco-languageclient monorepo](https://github.com/TypeFox/monaco-languageclient).

You find detailed information in the [official documentation](https://github.com/TypeFox/monaco-languageclient/blob/main/docs/index.md).

If interested, check [quick start for local development](https://github.com/TypeFox/monaco-languageclient#getting-started).

A detailed list of examples is contained in the GitHub repository, please see [this listing](https://github.com/TypeFox/monaco-languageclient#examples-overview).

## Usage

You can import the Monaco React component for easy use in an existing React project. Below you can see a quick example of a fully functional implementation in TypeScript. The React component uses the same configuration objects as `monaco-languageclient` directly with TypeScript/JavaScript.

On start, the language client can connect to a language server either via JSON-RPC over a WebSocket to an external server process, or directly in the browser where the language server runs in a web worker. In both cases, they use the Language Server Protocol to communicate. The React component is limited to one language client per component.

```tsx
import * as vscode from 'vscode';
// Import Monaco Language Client components
import { configureDefaultWorkerFactory } from 'monaco-languageclient/workerFactory';
import type { MonacoVscodeApiConfig } from 'monaco-languageclient/vscodeApiWrapper';
import { LcWebSocket, type LanguageClientConfig } from 'monaco-languageclient/lcwrapper';
import type { EditorAppConfig } from 'monaco-languageclient/editorApp';
import { MonacoEditorReactComp } from '@typefox/monaco-editor-react';
import React from 'react';
import ReactDOM from 'react-dom/client';

export const createEditorAndLanguageClient = async () => {
  const languageId = 'mylang';
  const code = '// initial editor content';
  const codeUri = '/workspace/hello.mylang';

  // Monaco VSCode API configuration
  const vscodeApiConfig: MonacoVscodeApiConfig = {
    $type: 'extended',
    viewsConfig: {
      $type: 'EditorService'
    },
    userConfiguration: {
      json: JSON.stringify({
        'workbench.colorTheme': 'Default Dark Modern',
        'editor.wordBasedSuggestions': 'off'
      })
    },
    monacoWorkerFactory: configureDefaultWorkerFactory
  };

  // Language client configuration
  const languageClientConfig: LanguageClientConfig = {
    languageId,
    connection: {
      options: {
        family: 'WebSocket'
        realization: () => new LcWebSocket(),
        // at this url the language server for myLang must be reachable
        url: 'ws://localhost:30000/myLangLS'
      }
    },
    clientOptions: {
      documentSelector: [languageId],
      workspaceFolder: {
        index: 0,
        name: 'workspace',
        uri: vscode.Uri.file('/workspace')
      }
    }
  };

  // editor app / monaco-editor configuration
  const editorAppConfig: EditorAppConfig = {
    codeResources: {
      modified: {
        text: code,
        uri: codeUri
      }
    }
  };

  const root = ReactDOM.createRoot(document.getElementById('react-root')!);
  const App = () => {
    return (
      <div style={{ backgroundColor: '#1f1f1f' }}>
        <MonacoEditorReactComp
          vscodeApiConfig={vscodeApiConfig}
          editorAppConfig={editorAppConfig}
          languageClientConfig={languageClientConfig}
          style={{ height: '100%' }}
          onError={(e) => {
            console.error(e);
          }}
        />
      </div>
    );
  };
  root.render(<App />);
};
createEditorAndLanguageClient();
```

## License

[MIT](https://github.com/TypeFox/monaco-languageclient/blob/main/packages/wrapper-react/LICENSE)

---
_Source: https://npm.io/package/@typefox/monaco-editor-react · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
