Frameworks
Nuxt
Set up the Vue DOCX editor in Nuxt with a client-only component, the editor stylesheet, and Vite dependency optimization.
Install
Install the published Vue adapter and its engine peer:
npm install @docx-editor.dev/vue @docx-editor.dev/coreConfigure Nuxt
Load the stylesheet once and prebundle the adapter and engine for the Vite dev server:
// nuxt.config.ts
export default defineNuxtConfig({
css: ['@docx-editor.dev/vue/styles.css'],
vite: {
optimizeDeps: {
include: ['@docx-editor.dev/core', '@docx-editor.dev/vue'],
},
},
});Mount a client-only component
Use the .client.vue suffix so Nuxt skips the component during server rendering:
<!-- components/DocumentEditor.client.vue -->
<script setup lang="ts">
import { DocxEditor } from '@docx-editor.dev/vue';
</script>
<template>
<div style="height: 100vh">
<DocxEditor document="blank" />
</div>
</template>Use the component from a page. Nuxt auto-imports components from the components directory.
<!-- pages/index.vue -->
<template>
<DocumentEditor />
</template>To open and download files, use the Vue component from the quickstart.
Limits
- Keep the editor import and markup inside the
.client.vuecomponent. The server output contains a placeholder. - The editor fills its parent, so the parent needs a measured height.
@docx-editor.dev/nuxthas"private": trueand is not published to npm. External apps use the Vue adapter setup on this page.
Run the example
The examples/nuxt starter uses the private workspace module and the workspace Nuxt version. It needs the Vue package build:
bun install
bun run build:packages:vue
bun run dev:nuxt # http://localhost:3002For clone steps, see Run a repository starter.
Next steps
- Vue adapter: Install and mount options.
- Vue props: Configure
<DocxEditor>. - Quickstart: Load, edit, and save a document.