For AI agents: the complete documentation index is available at /vue-codemirror6/llms.txt, the full documentation bundle is available at /vue-codemirror6/llms-full.txt, and this page is available as Markdown at /vue-codemirror6/api/index.md.
  • English
  • API Overview

    The CodeMirror component has three kinds of API:

    PageContent
    PropsOptions that configure the editor. Changes are applied without recreating it.
    EventsNotifications for loading, focus, document changes, and destruction.
    Instance APIProperties and methods available through a template ref.
    <script lang="ts" setup vapor>
    import { javascript } from '@codemirror/lang-javascript';
    import { ref } from 'vue';
    import CodeMirror, { type CodeMirrorExposed } from 'vue-codemirror6';
    
    const value = ref('');
    const cm = ref<CodeMirrorExposed>();
    </script>
    
    <template>
      <code-mirror
        ref="cm"
        v-model="value"
        basic
        :lang="javascript()"
        @ready="() => cm?.view?.focus()"
      />
    </template>