Skip to main content
The toolbar provides a customizable UI for document editing with support for custom buttons, responsive layouts, and role-based controls.

Quick start

Configuration

string
CSS selector for the toolbar container (e.g. '#toolbar'). Must be a string selector, not a DOM element reference.
string[]
default:"['left', 'center', 'right']"
Layout regions for button placement
Object
Custom button arrangement by group
string[]
default:"[]"
Button names to exclude from toolbar
Object
default:"{}"
Custom SVG icons for buttons. See Icon Customization.
Object
default:"{}"
Custom tooltips and labels
Array
default:"[]"
Available font options in font dropdown. See Font Configuration.
boolean
default:"true"
Auto-hide buttons on small screens
boolean
default:"false"
Size relative to container instead of window
Array
default:"[]"
Custom button definitions. See Custom Buttons.

Available buttons

Use button names with excludeItems, groups, and icons configuration.

Text formatting

button
Toggle bold (Ctrl+B)
button
Toggle italic (Ctrl+I)
button
Toggle underline (Ctrl+U)
button
Toggle strikethrough
button
Clear all formatting
button
Format painter — copy formatting from selection

Font controls

dropdown
Font family selector
dropdown
Font size selector (8–96pt)
dropdown
Text color picker
dropdown
Background highlight color picker

Paragraph

dropdown
Text alignment (left, center, right, justify)
button
Toggle bullet list
button
Toggle numbered list
button
Decrease indent
button
Increase indent
dropdown
Line height selector (1, 1.15, 1.5, 2, 2.5, 3)
dropdown
Quick paragraph styles (Normal, Heading 1, etc.)

Insert

Insert or edit link
button
Upload and insert image
dropdown
Insert table via grid selector
dropdown
Table editing actions (add/delete rows/columns, merge/split cells, etc.)

Tools

button
Undo last action
button
Redo last action
Search in document
dropdown
Zoom level (50%–200%)
button
Toggle document ruler
dropdown
Switch between editing/viewing/suggesting modes

Track changes

button
Accept tracked change at current selection
button
Reject tracked change at current selection

Custom buttons

Basic button

string
required
'button' or 'dropdown'
string
required
Unique button identifier
string
Hover text
string
SVG icon string
string
default:"'center'"
Layout group: 'left', 'center', or 'right'
string | function
required
Command name or handler function receiving { item, argument, option }
Array
required
Dropdown items, each with label (display text), key (value), and optional icon
boolean
default:"true"
Show dropdown arrow

Toggle button

boolean
default:"false"
Initial active state
string
Icon when active

Icon customization

Icons should be 24x24 viewBox SVGs with fill="currentColor" for proper theming

Font configuration

Array
SuperDoc does not load fonts automatically. Custom fonts from imported DOCX files will display in the toolbar, but won’t be selectable unless you load them in your application (via CSS @font-face, Google Fonts, etc.) and add them to the fonts array.

Responsive behavior

The toolbar adapts at these widths: Use responsiveToContainer: true to size based on the toolbar container instead of the window.

Role-based controls

The toolbar automatically adapts based on the user’s role:

API methods

getToolbarItemByName

Get a toolbar item by its name.

getToolbarItemByGroup

Get all toolbar items in a layout group.

updateToolbarState

Refresh all button states based on the current editor state.

setZoom

Set the editor zoom level programmatically.

destroy

Clean up toolbar resources and event listeners.

Events

superdoc-command

Fired when a SuperDoc-level command is executed (zoom, document mode).

exception

Fired when an error occurs during a toolbar action.

Full example

Custom Toolbar Example

Runnable example: custom button groups, excluded items, and a custom clear-formatting button