Skip to content

vue-wswg-editorWYSIWYG JSON Editor

A powerful Vue 3 library for visual page builders

vue-wswg-editor

Quick Start

Install the library and start building:

bash
npm install vue-wswg-editor

📦 Package: vue-wswg-editor on npm

Configure the Vite plugin in your vite.config.ts:

typescript
import { defineConfig } from "vite";
import vue from "@vitejs/plugin-vue";
import { fileURLToPath } from "url";
import { vueWswgEditorPlugin } from "vue-wswg-editor/vite-plugin";

export default defineConfig({
   plugins: [
      vue(),
      vueWswgEditorPlugin({
         rootDir: "@page-builder",
      }),
   ],
   resolve: {
      alias: {
         "@page-builder": fileURLToPath(new URL("./src/page-builder", import.meta.url)),
      },
   },
});

Use the editor component in your Vue app:

vue
<template>
   <WswgPageBuilder v-model="pageData" :editable="true" :showBrowserBar="true" />
</template>

<script setup lang="ts">
import { ref } from "vue";
import { WswgPageBuilder } from "vue-wswg-editor";
import "vue-wswg-editor/style.css";

const pageData = ref({
   blocks: [],
   settings: {},
});
</script>

Why vue-wswg-editor?

vue-wswg-editor provides a complete solution for building visual page editors in Vue 3 applications. It combines:

  • Ease of Use: Simple API with sensible defaults
  • Flexibility: Customizable blocks, layouts, and fields
  • Type Safety: Full TypeScript support
  • Performance: Optimized for large page configurations
  • Developer Experience: Zero-config block discovery via Vite plugin

Features

  • 🎨 Visual Page Builder - Drag-and-drop interface
  • 📝 Rich Field Editor - Comprehensive sidebar with multiple field types
  • 🎯 Block Management - Easy block manipulation
  • 📱 Responsive Preview - Desktop and mobile viewports
  • 🎨 Customizable Layouts - Multiple layout support
  • 🔧 Field Validation - Built-in and custom validators
  • 📦 TypeScript - Full type definitions
  • 🔌 Vite Plugin - Automatic component discovery

Ready to get started? Check out the Getting Started Guide.

Released under the MIT License.