Build powerful editors with model-first architecture
Barocss Editor provides a declarative DSL, efficient reconciliation, and extensible plugin system — supporting both DOM and React rendering targets.
pnpm add @barocss/editor-core @barocss/editor-view-dom @barocss/schema @barocss/dsl @barocss/extensionsWhy Barocss Editor
Declarative DSL
Define templates with pure functions — element, data, slot, when. Predictable, testable, and composable across templates, marks, and decorators.
Model-First
All editing operations work on the model, not the DOM. Enables reliable undo/redo, real-time collaboration, and deterministic testing.
Dual Renderer
Same DSL templates render to both DOM (VNode reconciliation) and React (direct ReactNode). Choose the rendering target that fits your stack.
Extensible
30+ built-in extensions for formatting, tables, code blocks, math, and more. Create custom commands, keybindings, and decorators with a clean API.
Type-Safe
Full TypeScript support with schema validation. Catch structural errors at compile time with strongly typed props for blocks and marks.
Collaboration Ready
Built-in adapters for Yjs and Liveblocks. AwarenessManager for cursors, ConflictResolver for concurrent edits, BaseAdapter for custom backends.
Try It Out
Edit the text below to see the editor in action.
Simple Setup
Four steps to a working editor — schema, templates, store, and view.
import { createSchema } from '@barocss/schema';
const schema = createSchema('doc', {
topNode: 'document',
nodes: {
document: { name: 'document', group: 'document', content: 'block+' },
paragraph: { name: 'paragraph', group: 'block', content: 'inline*' },
'inline-text': { name: 'inline-text', group: 'inline' },
},
});
import { define, element, data, slot } from '@barocss/dsl';
define('paragraph', element('p', { className: 'paragraph' }, [slot('content')]));
define('inline-text', element('span', {}, [data('text', '')]));
import { DataStore } from '@barocss/datastore';
const dataStore = new DataStore(undefined, schema);
import { Editor } from '@barocss/editor-core';
import { EditorViewDOM } from '@barocss/editor-view-dom';
import { createCoreExtensions } from '@barocss/extensions';
const editor = new Editor({ dataStore, schema, extensions: createCoreExtensions() });
new EditorViewDOM(editor, container).mount();
Architecture
Model-first architecture with dual rendering targets. Same DSL templates power both DOM and React outputs.
Rendering Pipeline
Shared template layer fans out to DOM reconciliation or direct React element construction.
Packages
Modular monorepo — use only what you need.