Skip to content

Starter Kit

StarterKit is a convenience extension that bundles the most commonly used nodes, marks, and behavior extensions into a single import. It gives you a fully featured editor with one line of configuration.

A fully featured editor powered by StarterKit alone. Try formatting, headings, lists, code blocks, links, keyboard shortcuts, and Markdown input rules.

With the default theme enabled. All toolbar items registered by StarterKit extensions are shown.

Click to try it out
import { Editor, StarterKit, defaultIcons } from '@domternal/core';
import '@domternal/theme';
const editorEl = document.getElementById('editor')!;
// Build a simple toolbar with bold, italic, underline buttons
const toolbar = document.createElement('div');
toolbar.className = 'dm-toolbar';
toolbar.innerHTML = `<div class="dm-toolbar-group">
<button class="dm-toolbar-button" data-mark="bold">${defaultIcons.textB}</button>
<button class="dm-toolbar-button" data-mark="italic">${defaultIcons.textItalic}</button>
<button class="dm-toolbar-button" data-mark="underline">${defaultIcons.textUnderline}</button>
</div>`;
editorEl.before(toolbar);
const editor = new Editor({
element: editorEl,
extensions: [StarterKit],
content: '<p>Hello world</p>',
});
// Toggle marks on click
toolbar.addEventListener('click', (e) => {
const btn = (e.target as Element).closest<HTMLButtonElement>('[data-mark]');
if (!btn) return;
editor.chain().focus().toggleMark(btn.dataset.mark!).run();
});
// Sync active states
editor.on('transaction', () => {
toolbar.querySelectorAll<HTMLButtonElement>('[data-mark]').forEach((btn) => {
btn.classList.toggle('dm-toolbar-button--active', editor.isActive(btn.dataset.mark!));
});
});

This is the manual approach. For a full toolbar with all StarterKit items (headings dropdown, lists, code blocks, history), use ToolbarController which auto-discovers toolbar items from extensions. See the Getting Started guide for the complete pattern.

This single extension provides 27 extensions out of the box: rich text formatting, lists, code blocks, links with autolink and popover, undo/redo, keyboard shortcuts, and more.

Pass an options object to StarterKit.configure() to customize any bundled extension:

const editor = new Editor({
extensions: [
StarterKit.configure({
heading: { levels: [1, 2, 3] },
history: { depth: 50 },
link: { openOnClick: false },
}),
],
});

Set any extension to false to exclude it from the bundle:

const editor = new Editor({
extensions: [
StarterKit.configure({
codeBlock: false,
strike: false,
horizontalRule: false,
}),
],
});

To swap a bundled extension for a custom version, disable it in StarterKit and add the replacement separately:

import { Editor, StarterKit } from '@domternal/core';
import { CodeBlockLowlight } from '@domternal/extension-code-block-lowlight';
import { common, createLowlight } from 'lowlight';
const editor = new Editor({
extensions: [
StarterKit.configure({ codeBlock: false }),
CodeBlockLowlight.configure({ lowlight: createLowlight(common) }),
],
});

Extensions not included in StarterKit are added alongside it in the extensions array:

import { Editor, StarterKit, TextStyle, TextColor, Subscript } from '@domternal/core';
import { Table } from '@domternal/extension-table';
const editor = new Editor({
extensions: [StarterKit, TextStyle, TextColor, Subscript, Table],
});

StarterKit includes 27 extensions organized into three categories.

ExtensionProseMirror nameOption keyDescription
DocumentdocdocumentTop-level document container
TexttexttextInline text content
ParagraphparagraphparagraphBlock-level paragraph
HeadingheadingheadingHeadings h1 through h4
BlockquoteblockquoteblockquoteBlock-level quotation
Code BlockcodeBlockcodeBlockFenced code block
Bullet ListbulletListbulletListUnordered list
Ordered ListorderedListorderedListNumbered list
List ItemlistItemlistItemList item inside bullet/ordered lists
Task ListtaskListtaskListCheckbox list
Task ItemtaskItemtaskItemCheckbox list item
Horizontal RulehorizontalRulehorizontalRuleHorizontal separator line
Hard BreakhardBreakhardBreakLine break within a block
ExtensionProseMirror nameOption keyDescription
BoldboldboldBold text formatting
ItalicitalicitalicItalic text formatting
UnderlineunderlineunderlineUnderlined text
StrikestrikestrikeStrikethrough text
CodecodecodeInline code
LinklinklinkHyperlink
ExtensionOption keyDescription
Base KeymapbaseKeymapStandard ProseMirror key bindings (Enter, Backspace, etc.)
HistoryhistoryUndo/redo with Mod-Z / Mod-Shift-Z
DropcursordropcursorVisual indicator when dragging content
GapcursorgapcursorCursor placement in positions that don’t allow text (e.g. before/after tables)
Trailing NodetrailingNodeEnsures a paragraph exists at the end of the document
List KeymaplistKeymapTab/Shift-Tab indent/outdent and Backspace lift for list items
Link PopoverlinkPopoverURL input popover triggered by Mod-K or the link toolbar button
Selection DecorationselectionDecorationCollapses range selections to a cursor on blur, preventing ghost selections

Every bundled extension has a corresponding option key. Each accepts either false (to disable) or an options object (to configure).

interface StarterKitOptions {
// Nodes
document?: false;
text?: false;
paragraph?: false | Partial<ParagraphOptions>;
heading?: false | Partial<HeadingOptions>;
blockquote?: false | Partial<BlockquoteOptions>;
codeBlock?: false | Partial<CodeBlockOptions>;
bulletList?: false | Partial<BulletListOptions>;
orderedList?: false | Partial<OrderedListOptions>;
listItem?: false | Partial<ListItemOptions>;
horizontalRule?: false | Partial<HorizontalRuleOptions>;
hardBreak?: false | Partial<HardBreakOptions>;
taskList?: false | Partial<TaskListOptions>;
taskItem?: false | Partial<TaskItemOptions>;
// Marks
bold?: false | Partial<BoldOptions>;
italic?: false | Partial<ItalicOptions>;
underline?: false | Partial<UnderlineOptions>;
strike?: false | Partial<StrikeOptions>;
code?: false | Partial<CodeOptions>;
link?: false | Partial<LinkOptions>;
// Behavior
baseKeymap?: false | Partial<BaseKeymapOptions>;
history?: false | Partial<HistoryOptions>;
dropcursor?: false | Partial<DropcursorOptions>;
gapcursor?: false;
trailingNode?: false | Partial<TrailingNodeOptions>;
listKeymap?: false | Partial<ListKeymapOptions>;
linkPopover?: false | Partial<LinkPopoverOptions>;
selectionDecoration?: false;
}

StarterKit itself does not register any commands. All commands come from the individual bundled extensions. See each extension’s documentation page for its commands.

StarterKit itself does not register any keyboard shortcuts. All shortcuts come from the bundled extensions. Here is a summary:

ShortcutCommandExtension
Mod-BToggle boldBold
Mod-IToggle italicItalic
Mod-UToggle underlineUnderline
Mod-Shift-SToggle strikethroughStrike
Mod-EToggle inline codeCode
Mod-KOpen link popoverLink
ShortcutCommandExtension
Mod-Alt-0Set paragraphParagraph
Mod-Alt-1 to Mod-Alt-4Set heading levelHeading
Mod-Shift-BToggle blockquoteBlockquote
Mod-Alt-CToggle code blockCode Block
Mod-Shift-8Toggle bullet listBullet List
Mod-Shift-7Toggle ordered listOrdered List
Mod-Shift-9Toggle task listTask List
Mod-EnterToggle task checkedTask Item
ShortcutCommandExtension
Mod-ZUndoHistory
Mod-Shift-ZRedoHistory
Mod-YRedoHistory
Shift-EnterInsert hard breakHard Break
TabIndent list itemList Keymap
Shift-TabOutdent list itemList Keymap

All input rules come from the bundled extensions:

InputResultExtension
**text**BoldBold
__text__BoldBold
*text*ItalicItalic
_text_ItalicItalic
`text`Inline codeCode
~~text~~StrikethroughStrike
# to #### Heading level 1-4Heading
> BlockquoteBlockquote
```Code blockCode Block
- , * , + Bullet listBullet List
1. Ordered listOrdered List
[ ] , [x] Task listTask List
---, ___, ***Horizontal ruleHorizontal Rule

StarterKit itself does not register toolbar items. All toolbar items come from the bundled extensions. When using a toolbar controller, the following items are available:

ItemTypeGroupExtension
boldbuttonformatBold
italicbuttonformatItalic
underlinebuttonformatUnderline
strikebuttonformatStrike
codebuttonformatCode
linkbuttonformatLink
headingdropdownblocksHeading
blockquotebuttonblocksBlockquote
codeBlockbuttonblocksCode Block
bulletListbuttonlistsBullet List
orderedListbuttonlistsOrdered List
taskListbuttonlistsTask List
horizontalRulebuttonblocksHorizontal Rule
hardBreakbuttoninsertHard Break
undobuttonhistoryHistory
redobuttonhistoryHistory

StarterKit uses the addExtensions() hook to return an array of sub-extensions. Internally, a maybeAdd helper checks each option:

  1. If the option is false, the extension is skipped entirely
  2. If the option is an object with keys, the extension is added with .configure(options)
  3. Otherwise (undefined or empty object), the extension is added with its defaults

This means StarterKit with no configuration is equivalent to adding all 27 extensions individually with their default options.

import { StarterKit } from '@domternal/core';
import type { StarterKitOptions } from '@domternal/core';
ExportTypeDescription
StarterKitExtensionThe starter kit bundle extension
StarterKitOptionsTypeScript typeOptions for StarterKit.configure()

@domternal/core - StarterKit.ts