Skip to main content

Toolbar

These options control how the editor toolbar is laid out, how it handles overflow, and where it is positioned.

Options

OptionTypeDefaultDescription
toolbarboolean/string/string[]'undo redo | blocks | bold italic | alignleft aligncenter alignright | indent outdent | bullist numlist | code | table help'Toolbar button layout. Pass a string of space-separated button names with | as group separators, an array of strings for multiple rows, or false to hide the toolbar.
toolbar_modestring'floating' (mobile: 'scrolling')How the toolbar handles overflow when buttons do not fit. Options: 'floating' (overflow menu), 'sliding' (slide-out drawer), 'scrolling' (horizontal scroll), 'wrap' (wrap to next line).
toolbar_groupsobject{}Named groups of toolbar buttons that collapse into a single group button. Each key is the group name and the value is an object with an items array.
toolbar_locationstring'auto'Where the toolbar is placed. 'auto' uses the default position, 'top' forces it above the content, 'bottom' places it below.
toolbar_persistbooleanfalseKeep the toolbar of an inline editor visible even when the editor loses focus.
toolbar_stickybooleansame as inlineMake the toolbar stick to the top of the viewport when scrolling past the editor. Enabled by default for inline editors.
toolbar_sticky_offsetnumber0Offset in pixels from the top of the viewport when the toolbar is in sticky mode. Useful when the page has a fixed header.
fixed_toolbar_containerstring''CSS selector for an element that should contain the toolbar, detaching it from the editor frame. Only works with inline editors.
fixed_toolbar_container_targetHTMLElementDirect DOM element reference for the fixed toolbar container. Use instead of fixed_toolbar_container when you already have a reference.
ui_modestring'combined'Controls how the editor UI is structured.

Example

editor42.init({
selector: 'textarea',
toolbar: 'undo redo | blocks | bold italic underline | alignleft aligncenter alignright | bullist numlist | link image',
toolbar_mode: 'sliding',
toolbar_sticky: true,
toolbar_sticky_offset: 64,
toolbar_location: 'top'
});