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.

Choose StarterKit when you need:

  • A fully featured editor in one import (27 extensions wired up)
  • A sensible default for new projects without manually configuring core nodes/marks
  • The ability to disable individual extensions via StarterKit.configure({ bold: false })

Skip it if:

  • You need a smaller bundle and only a subset of features (import each extension individually)
  • You want non-default options on a sub-extension (configure via StarterKit.configure({ history: { depth: 200 } }))
  • You need extensions not bundled here (e.g. Table, Image, Emoji); add them separately alongside StarterKit

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 { StarterKit } from '@domternal/core';
import { DomternalEditor, DomternalToolbar } from '@domternal/vanilla';
import '@domternal/theme';
const editorEl = document.getElementById('editor')!;
const toolbarEl = document.createElement('div');
editorEl.before(toolbarEl);
const dm = new DomternalEditor(editorEl, {
extensions: [StarterKit],
content: '<p>Hello world</p>',
});
new DomternalToolbar(toolbarEl, { editor: dm.editor });

DomternalToolbar auto-discovers all StarterKit toolbar items (bold/italic/underline marks, headings dropdown, lists, code blocks, history, etc.) and wires active/disabled state automatically.

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,
}),
],
});

One disable is required rather than optional: collaborative editors must run with history: false, because the Pro Collaboration extension replaces History with collaboration-aware undo/redo.

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

One more behavior extension ships with StarterKit but is off by default: List Indent. Enable it with StarterKit.configure({ listIndent: true }). It adds Tab/Shift-Tab at the boundary between a top-level block and an adjacent list. It stays off by default because Tab on a paragraph that merely follows a list would otherwise pull that paragraph into the list instead of moving focus to the next field, which is a surprise in embedded / form usage. StarterKit registers it after ListKeymap, and that order is load-bearing: collected keymaps run later-first, so ListIndent gets the first look and defers to ListKeymap for in-list Tab/Shift-Tab.

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>;
listIndent?: boolean; // opt-in, off by default; set to true to enable
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 checked inside a task item, otherwise insert a hard breakTask Item / Hard Break

Both TaskItem and Hard Break bind Mod-Enter. Collected keymaps run later-first, so TaskItem gets the first look and returns false outside a task item, which lets the binding fall through to setHardBreak.

ShortcutCommandExtension
Mod-ZUndoHistory
Mod-Shift-ZRedoHistory
Mod-YRedoHistory
Shift-EnterInsert hard breakHard Break
Mod-Shift-SpaceInsert non-breaking spaceHard 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