Skip to content

Getting Started

Pick your setup: Vanilla for a themed editor with toolbar and bubble menu out of the box, Angular, React, or Vue for ready-made components with auto-rendered toolbar and menus, or Headless for a bare editor you style yourself.

Click to try it out
  1. Terminal window
    pnpm add @domternal/core @domternal/theme @domternal/vanilla
  2. import { StarterKit, BubbleMenu } from '@domternal/core';
    import {
    DomternalEditor,
    DomternalToolbar,
    DomternalBubbleMenu,
    } from '@domternal/vanilla';
    import '@domternal/theme';
    const toolbarEl = document.getElementById('toolbar')!;
    const editorEl = document.getElementById('editor')!;
    const bubbleEl = document.getElementById('bubble')!;
    const dm = new DomternalEditor(editorEl, {
    extensions: [StarterKit, BubbleMenu.configure({ element: bubbleEl })],
    content: '<p>Hello world</p>',
    });
    new DomternalToolbar(toolbarEl, { editor: dm.editor });
    new DomternalBubbleMenu(bubbleEl, { editor: dm.editor });

    StarterKit provides paragraphs, headings, lists, blockquotes, code blocks, task lists, inline formatting, keyboard shortcuts, and undo/redo. The @domternal/vanilla wrapper provides class-based components with .destroy() cleanup and EventTarget events. The @domternal/theme package adds editor styles, a toolbar layout, and 49 built-in icons via defaultIcons.

    For full control, skip StarterKit and import only the extensions you need.

Every extension in the kit can be disabled with false or configured with options:

StarterKit.configure({
codeBlock: false, // disable an extension
heading: { levels: [1, 2, 3, 4] }, // limit heading levels
history: { depth: 50 }, // configure undo stack
link: { openOnClick: false }, // keep links non-clickable while editing
linkPopover: false, // disable the built-in link popover
})

The full list of bundled extensions:

CategoryIncluded
NodesDocument, Text, Paragraph, Heading, Blockquote, CodeBlock, BulletList, OrderedList, ListItem, TaskList, TaskItem, HorizontalRule, HardBreak
MarksBold, Italic, Underline, Strike, Code, Link
BehaviorsBaseKeymap, History, Dropcursor, Gapcursor, TrailingNode, ListKeymap, LinkPopover, SelectionDecoration

Now that your editor is running, explore the rest of the toolkit:

  • StarterKit - see above for the full list of bundled extensions and how to configure them
  • Extensions - add tables, images, emoji, mentions, and syntax-highlighted code blocks via standalone packages
  • Theming - customize colors, spacing, and fonts with 70+ CSS custom properties on .dm-editor
  • Editor API - chain commands, listen to events, and read or update content programmatically
  • StackBlitz Example - a full working vanilla editor with all extensions you can edit in the browser