vue-codemirror
Vue 3 component wrapping the CodeMirror 6 code editor
Repository Health
Technical Analysis
vue-codemirror wraps CodeMirror 6 as a native Vue 3 component, exposing the editor’s state and extensions through familiar Vue props, events, and v-model binding. Rather than reimplementing editor behavior, it’s a thin integration layer: you install CodeMirror language and theme packages directly from the CodeMirror 6 ecosystem and pass them in as extensions, keeping the component’s own surface area small.
The component supports both local (<Codemirror>) and global (app.use(VueCodemirror, options)) registration, ships CodeMirror’s basic-setup extension bundle by default for a batteries-included starting point, and emits ready/change/focus/blur/update events that expose the underlying EditorView instance for advanced state inspection. This version targets Vue 3 and CodeMirror 6 only — Vue 2 or CodeMirror 5 users need the separate vue-codemirror@4.x legacy branch.
What You Get
- A
<Codemirror>component withv-modeltwo-way binding for editor content - Local component usage or global
app.use(VueCodemirror, options)registration with shared defaults - Direct pass-through of CodeMirror 6
extensions(languages, themes, linting) with no wrapper API to learn ready/change/focus/blur/updateevents exposing the liveEditorViewandEditorState- CodeMirror’s
basic-setupbundle enabled by default for a working editor out of the box - Configurable props for autofocus, tab size, indent-with-tab, placeholder, and disabled state
Common Use Cases
- Embedding a code editor into a Vue 3 admin panel, playground, or CMS content field
- Building a web IDE or in-browser code-execution tool with syntax highlighting per language
- Adding a JSON/YAML/config editor with live validation to a Vue application
- Rendering a themeable code snippet editor with two-way binding to component state
Under The Hood
Architecture - The component (src/component.ts) is a Vue 3 defineComponent that owns a shallow-ref EditorState/EditorView pair; on mount it calls createEditorState/createEditorView (in codemirror.ts) to instantiate CodeMirror against a container div, merges component props with global defaults resolved via useGlobalConfig() (config.ts), and reconfigures the CodeMirror extension set reactively as props change, emitting Vue events (focus/blur/update/change) from CodeMirror’s own callback hooks. Tech Stack - Written in TypeScript against Vue 3’s Composition API (shallowRef, computed, watch, onMounted/onBeforeUnmount) and CodeMirror 6’s @codemirror/state/@codemirror/view packages, built with a custom libundler.config.ts and Vite for the dev/demo app, with codemirror’s basic-setup bundle as an optional default extension. Code Quality - A dedicated test/index.test.ts suite plus Codecov integration referenced in the README cover component mounting and event behavior; the source is split into small single-responsibility files (component.ts, codemirror.ts, config.ts, events.ts, props.ts) which keeps each concern easy to audit despite the project having no commits since 2024. API Design - The component intentionally exposes CodeMirror’s native extensions array directly rather than wrapping it, so anyone who already knows CodeMirror 6’s API can configure languages/themes without learning a vue-codemirror-specific abstraction, at the cost of requiring consumers to install CodeMirror packages themselves as documented in the README.
Used by 6 apps in this directory
1Panel
Devops · Hosting Control Panel · Monitoring
The only open-source VPS control panel with native AI agent runtime — deploy websites, Docker stacks, and local LLMs from one web interface.
DataEase
Analytics · Data Engineering · AI Assistants
Open-source BI tool with drag-and-drop dashboards, 20+ data source connectors, and AI-powered natural language queries — a self-hosted alternative to Tableau.
Flowfile
Data Engineering
Visual ETL that compiles to Polars — build pipelines on a canvas, export as standalone Python, and run anywhere without platform lock-in.
Hook0
Devops
Open-source Webhooks-as-a-Service: deliver events to your users with auto-retry, signed payloads, and a real-time subscriber dashboard — all without building the infrastructure yourself.
MaxKB
AI Development · Knowledge Management
Build enterprise-grade AI agents with RAG, workflows & multi-modal support
OpnForm
Forms Surveys · Marketing
Build unlimited, embeddable forms with no code — powered by AI, logic rules, and real-time analytics