React CodeMirror

A fully-typed React component and hook for embedding the CodeMirror 6 code editor with themes and language extensions.

Library
npm
v4.25.11
2,245stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
69/100Good
Development Activity48
Maintenance68
Community60
Maturity60
Momentum40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
79/100Good
Architecture80
Code Quality82
Innovation74
Learning Curve78

@uiw/react-codemirror wraps CodeMirror 6 in a single React component so applications can drop in a syntax-highlighted, extensible code editor without hand-rolling the imperative CodeMirror setup themselves. It exposes both a <CodeMirror /> component and a useCodeMirror hook, forwarding CodeMirror’s extension system directly through props so language support, linting, autocompletion, and custom themes are all configured declaratively.

The package is the hub of a larger monorepo of companion packages — dozens of prebuilt themes (Dracula, GitHub, Monokai, Nord, VS Code, and more), reusable extensions (basic setup, hyperlinks, mentions, zebra stripes, relative line numbers), and a separate merge-view package for side-by-side diffing — all versioned and released together, letting consumers pull in only what they need.

What You Get

  • A <CodeMirror /> component with value, onChange, theme, extensions, and sizing props that map directly onto CodeMirror 6 concepts
  • A standalone useCodeMirror hook for teams that want to control the container and lifecycle themselves
  • A ReactCodeMirrorRef imperative handle exposing the live EditorView and EditorState for advanced integrations
  • Companion packages for dozens of prebuilt syntax themes, language extension bundles, and a side-by-side merge/diff editor
  • Full TypeScript typings generated alongside the source, including typed extension and theme options

Common Use Cases

  • Embedding a syntax-highlighted code editor in developer tools, admin panels, or documentation playgrounds
  • Building in-browser IDEs or code-sandbox experiences with live language support (JS, Python, Go, Markdown, SQL, and more via CodeMirror language packages)
  • Adding a themeable JSON/YAML/config editor to a settings or CMS UI
  • Rendering a read-only, syntax-highlighted code viewer with custom decorations or line highlighting
  • Building diffing/merge UIs via the companion react-codemirror-merge package

Under The Hood

Architecture — The package centers on useCodeMirror (core/src/useCodeMirror.ts), a hook that owns the CodeMirror EditorState/EditorView lifecycle via useLayoutEffect/useEffect. It builds an extension array by merging an updateListener (which drives onChange/onStatistics/onUpdate), a dimension theme computed from height/width props, and the caller’s own extensions prop, then reconciles changes to that array on prop changes via StateEffect.reconfigure. The <CodeMirror /> component (core/src/index.tsx) is a thin forwardRef wrapper that renders the mount <div>, delegates all state to the hook, and exposes editor/state/view through useImperativeHandle. External value changes are diffed against the live document and dispatched as annotated transactions to avoid re-triggering onChange in a loop.

Tech Stack — Written in TypeScript, built with tsbb (a Babel/Rollup-based bundler) into separate cjs/esm outputs, and managed as a Lerna monorepo (lerna.json, npm workspaces spanning core, themes/*, extensions/*, and merge). CodeMirror 6 packages (@codemirror/state, @codemirror/view, @codemirror/commands, @codemirror/theme-one-dark) and React are declared as peer dependencies, so consumers control their own CodeMirror and React versions; the sibling @uiw/codemirror-extensions-basic-setup package is a regular dependency providing the default keymap/gutter/search extension bundle.

Code Quality — The core/src/__tests__/index.test.tsx suite uses Testing Library and react-test-renderer, and goes to real lengths to make CodeMirror work under JSDOM — mocking Range.getClientRects, IntersectionObserver, ResizeObserver, and MutationObserver, and stubbing element layout getters — indicating the maintainers actively fight the gap between a real browser and CodeMirror 6’s layout assumptions rather than skipping coverage. Source files are small and single-purpose (useCodeMirror.ts, getDefaultExtensions.ts, timeoutLatch.ts, utils.ts), each under 210 lines, with consistent TypeScript interfaces for every prop surface.

API Design — The public API stays close to CodeMirror 6’s own vocabulary (extensions, EditorView, EditorState) rather than inventing a parallel abstraction, which keeps the learning curve low for anyone who has read CodeMirror’s own docs, while props like theme: 'light' | 'dark' | 'none' | Extension and basicSetup: boolean | BasicSetupOptions give a simple default path plus an escape hatch into full CodeMirror configuration. Getting started requires only value, onChange, and an extensions array for language support, as shown directly in the README’s copy-pasteable example.

Used by 49 apps in this directory

TypeScript
99%
Other

Activepieces

Automation · AI Assistants

23,887

Open-source AI automation platform that converts 280+ workflow integrations into MCP servers for LLMs, with no-code builders and TypeScript extensibility.

View details
92
Repo Health
85
Technical
65
Dependency
Built with
TypeScript99%
Updated today
TypeScript
94%
MIT

Actual

Invoicing Finance

28,224

Local-first personal finance with envelope budgeting, end-to-end encryption, and multi-device sync — no subscription required.

View details
93
Repo Health
85
Technical
77
Dependency
Built with
TypeScript94%
Updated yesterday
Python
66%
Apache 2.0

Agent Control

AI Agents

295

An open-source runtime control plane for AI agents — define safety guardrails once, apply them across agents built on LangChain, CrewAI, Google ADK, or AWS Strands, and update controls without redeploying code.

View details
79
Repo Health
71
Technical
70
Dependency
Built with
Python66%
TypeScript33%
Updated yesterday
TypeScript
95%
Apache 2.0

AionUi

AI Agents · Productivity

32,102

Free, open-source Cowork desktop app that unifies Claude Code, Codex, Gemini CLI, and 20+ AI agents into a single platform with multi-agent teams, 24/7 cron automation, and zero-config built-in agent.

View details
88
Repo Health
76
Technical
66
Dependency
Built with
TypeScript95%
Updated today
TypeScript
99%
Other

byterover-cli

AI Agents · AI Code Assistants

4,941

A portable memory layer for AI coding agents — curate structured project knowledge into a version-controlled context tree that syncs across tools, machines, and teammates.

View details
77
Repo Health
83
Technical
71
Dependency
Built with
TypeScript99%
Updated 1 months ago
TypeScript
99%
AGPL 3.0

Cherry Studio

AI Assistants

50,753

All-in-one AI desktop client with 300+ assistants and multi-model support

View details
88
Repo Health
84
Technical
71
Dependency
Built with
TypeScript99%
Updated today
TypeScript
92%
MIT

Dittofeed

Marketing · Automation

2,903

Open-source omni-channel customer engagement platform for automating transactional and marketing messages via email, SMS, WhatsApp, Slack, and mobile push.

View details
54
Repo Health
75
Technical
63
Dependency
Built with
TypeScript92%
Updated 4 months ago
TypeScript
99%
Other

Dokploy

Devops · Hosting Control Panel · Security

36,702

Self-hosted PaaS that deploys apps and databases on your own VPS using Docker, Traefik, and multi-build-system orchestration

View details
89
Repo Health
76
Technical
65
Dependency
Built with
TypeScript99%
Updated yesterday
Go
73%
Other

Flipt

Devops · Developer Tools

4,872

Git-native feature flag platform that stores, versions, and deploys feature toggles directly in your own Git repositories with no external database required.

View details
90
Repo Health
83
Technical
70
Dependency
Built with
Go73%
TypeScript26%
Updated today

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search