VEditor for React

A controlled component with `value` and `onChange`, without JSX in the package and without a build step.

  • Tested: 18
  • Compatible code: 17+
  • PHP 8.1+
React application with the VEditor component and its state shown below

Installation in 3 steps

  1. Install

    React is a peer dependency. The package contains no licence logic.

    terminal
    npm install @veditor.eu/react
  2. Import

    The editor itself is loaded from your server (assetsUrl, by default the route of the Laravel or Symfony integration).

    JavaScript
    import { VEditor } from '@veditor.eu/react';
  3. Use

    Options as in the plain editor; onReady gives you the editor API.

    JSX
    <VEditor
      name="content"
      value={html}
      onChange={setHtml}
      options={{ licenseKey: 'VED1.…', ai: { url: '/veditor/ai', csrfToken } }}
      onReady={(editor) => console.log(editor.getStats())} />

What you get

Integration features for React, where you would expect them.

Full integration documentation

  • Controlled componentChanging value from outside replaces the content, without an event loop.
  • Loaded onceThe editor modules and styles load on first use, once per page.
  • Editor APIonReady(editor) with execute(), getStats() and the rest of the API.
  • Bundler friendlyVite and webpack skip the runtime import, so the editor is not bundled twice.
  • TypeScriptType declarations for the props, options and the editor instance.

Try it in your browser

The demo has the full toolbar and shows what the PHP sanitizer returns for your content.