Skip to main content
Modules are the building blocks of the Lumen Editor toolbar. Every button you see — bold, heading, image insert, undo — is a module: a plain object that describes the button’s appearance and what happens when it is clicked. You can access the 17 built-in modules, override them, reorder them, and add your own using the same interface.

EditorModule Interface

Every module — built-in or custom — implements the EditorModule interface:
string
required
A unique command identifier for the module. This is the string you reference in the toolbar option array to place the button. It must be unique across all registered modules.
string
required
The logical category of the command. Accepted values are 'inline', 'block', 'history', and 'insert'. The group does not affect rendering — it is metadata for your own organisation and for any third-party plugins that inspect the module registry.
string
required
An HTML string rendered as the inner content of the toolbar button. You can use an SVG literal, a Unicode character, an <img> tag, or any valid HTML fragment. The string is injected via innerHTML, so keep it trusted.
string
required
The tooltip text displayed on hover and used as the button’s aria-label. Keep labels short and descriptive — they are the primary accessibility affordance for the toolbar button.
(editor: Editor) => void
required
The function called when the toolbar button is clicked. Receives the live Editor instance so you can call any public method — setHTML(), getHTML(), on(), focus(), etc. — or interact with document.execCommand for low-level formatting.

Accessing Built-in Modules

Lumen Editor exports all built-in modules as a keyed record object:
Each built-in module is accessible by its name as a key:
You can spread modules into your own array, override individual entries, or pick specific ones to keep the toolbar minimal:

Built-in Module Names

All 17 built-in modules and their groups:

Registering Custom Modules

To add a custom module, include it in the modules array alongside the built-ins, and add its name to the toolbar layout. The example below adds a Highlight button that applies a yellow background to selected text:
A module listed in the toolbar array but absent from modules is silently skipped — no button is rendered and no error is thrown. Always make sure every command name in toolbar has a corresponding entry in modules.
To override a built-in module’s icon or behaviour, spread the original and replace only the properties you want to change:

TypeScript Exports

Lumen Editor ships full TypeScript declarations. The following types are exported from the lumen-editor package and can be used to type plugins, modules, and editor options in your project:
Using these types in a custom module ensures your code is checked at compile time: