Vue Quill Component

1.5.1 · active · verified Tue Apr 21

vue-quill is a Vue component that wraps the Quill rich text editor, providing an easy way to integrate Quill into Vue applications. As of version 1.5.1, it offers straightforward v-model binding for content (defaulting to Quill's Delta format, with an option for raw HTML output), configurable editor options, custom formats, and keybindings. While no explicit release cadence is stated, recent updates (v1.4.0, v1.1.0) suggest active maintenance, primarily supporting Vue 2. Key differentiators include its simplicity as a direct wrapper, direct event emission for content updates, and explicit guidance for Vue 1 compatibility via older versions. Developers must manually include Quill's CSS for correct styling.

Common errors

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to install vue-quill, register its component, and use it with v-model. It initializes content as a Delta object, applies a custom configuration, outputs content as HTML, and shows event handling. Crucially, it includes the necessary Quill CSS link.

import Vue from 'vue';
import VueQuill from 'vue-quill';

// Install the plugin to register the <quill> component globally
Vue.use(VueQuill);

// Mount a Vue app (example for Vue 2)
new Vue({
  el: '#app',
  data() {
    return {
      // Initialize content as a valid Delta object for best practice
      content: {
        ops: [
          { insert: 'Hello ' },
          { insert: 'Vue-Quill', attributes: { bold: true } },
          { insert: '\nThis is an example.' }
        ]
      },
      editorConfig: {
        placeholder: 'Start composing your epic...', 
        theme: 'snow',
        modules: {
          toolbar: [
            ['bold', 'italic', 'underline', 'strike'],
            [{ 'list': 'ordered' }, { 'list': 'bullet' }],
            ['link']
          ]
        }
      }
    };
  },
  template: `
    <div>
      <link href="https://cdn.quilljs.com/1.2.6/quill.snow.css" rel="stylesheet">
      <p>Edit the content below:</p>
      <quill v-model="content" :config="editorConfig" @selection-change="handleSelectionChange" output="html"></quill>
      <p>HTML Output:</p>
      <div style="border: 1px solid #ccc; padding: 10px; min-height: 100px;">{{ content }}</div>
    </div>
  `,
  methods: {
    handleSelectionChange(editor, range) {
      if (range) {
        console.log('Selection changed:', editor.getText(range.index, range.length));
      }
    }
  }
});

view raw JSON →