Frameworks

Vite with Vue

Set up a client-rendered Vue 3 DOCX editor with Vite.

Install

npm install @docx-editor.dev/vue @docx-editor.dev/core

Mount the editor

Vite renders on the client, so you do not need a server-rendering boundary. Import the stylesheet in the entry and mount the app:

// src/main.ts
import { createApp } from 'vue';
import '@docx-editor.dev/vue/styles.css';
import App from './App.vue';

createApp(App).mount('#app');

Render the editor in a container with a height:

<!-- src/App.vue -->
<script setup lang="ts">
import { DocxEditor } from '@docx-editor.dev/vue';
</script>

<template>
  <div style="height: 100vh">
    <DocxEditor document="blank" />
  </div>
</template>

To open and download files, use the Vue component from the quickstart.

Limits

  • Mount the app on the element from your index.html. The standard Vite Vue template uses #app.
  • This setup assumes a client-rendered Vite app. For Nuxt, see Nuxt.
  • The editor fills its parent, so the parent needs a measured height.

Run the example

The examples/vue starter aliases package source, so it needs no package build. After you clone the repository and run bun install, run:

bun run dev:vue   # http://localhost:5174

Next steps