Customize the Canvas Bar to add, remove, or rearrange components for your specific workflow.

The Canvas Bar is a floating toolbar that appears above the canvas, providing quick access to document-level actions like adding pages or opening settings. It can appear at the top or bottom of the canvas, with each position maintaining independent component orders.
This guide covers how to retrieve the component order, remove or update existing components, insert new ones, and configure different layouts for each edit mode.
Retrieving the Canvas Bar Order#
We can retrieve the current Canvas Bar component order using cesdk.ui.getCanvasBarOrder(). This returns an array of component configurations for the specified position.
// Get the current Canvas Bar order for the bottom positionconst currentOrder = cesdk.ui.getCanvasBarOrder('bottom');console.log('Current bottom Canvas Bar order:', currentOrder);
// Get the order for a specific edit modeconst textModeOrder = cesdk.ui.getCanvasBarOrder('bottom', { editMode: 'Text'});console.log('Text mode Canvas Bar order:', textModeOrder);The returned array contains objects with component IDs and any additional configuration. We log both the default Transform mode order and the Text edit mode order to see how they differ.
Removing Components#
We can remove components from the Canvas Bar using cesdk.ui.removeCanvasBarOrderComponent(). This is useful for creating focused editing experiences.
// Remove the add page button for a single-page workflowcesdk.ui.removeCanvasBarOrderComponent( 'ly.img.page.add.canvasBar', 'bottom');Here we remove the add page button for a single-page document workflow. The matcher can be a component ID string, an index number, 'first', 'last', a partial object, or a predicate function.
Updating Components#
We can modify existing components using cesdk.ui.updateCanvasBarOrderComponent(). This allows changing properties like icons, labels, or click handlers without removing and reinserting.
// Update the export button with custom properties// Components that read from payload can be customized this waycesdk.ui.updateCanvasBarOrderComponent( 'ly.img.export.canvasBar', { label: 'Export PNG', icon: '@imgly/Image' }, 'bottom');In this example, we update the custom export button’s label and icon. Custom components that read from their payload can be dynamically updated this way.
Inserting Components#
We can add new components to the Canvas Bar using cesdk.ui.insertCanvasBarOrderComponent(). The method accepts a matcher to find the reference component, the new component to insert, the position, and optionally the location relative to the matched component.
// Insert the registered export button after the settings buttoncesdk.ui.insertCanvasBarOrderComponent( 'ly.img.settings.canvasBar', 'ly.img.export.canvasBar', 'bottom', 'after');In this example, we insert a custom export button after the settings button by referencing its component ID. The location options are:
'before'- Insert before the matched component'after'- Insert after the matched component (default)'replace'- Replace the matched component
Setting a Complete Order#
For complete control over the Canvas Bar, we can replace the entire order using cesdk.ui.setCanvasBarOrder(). Pass an array of component IDs.
// Set a completely custom Canvas Bar order for the bottom position// Reference the registered components by their IDs// Use spacers on both sides of the theme toggle to center itcesdk.ui.setCanvasBarOrder( [ 'ly.img.settings.canvasBar', 'ly.img.separator', 'ly.img.export.canvasBar', 'ly.img.spacer', 'ly.img.themeSwitcher.canvasBar', 'ly.img.spacer' ], 'bottom');
// Also customize the top Canvas Bar with undo/redo and zoom controlscesdk.ui.setCanvasBarOrder( [ 'ly.img.undo.canvasBar', 'ly.img.redo.canvasBar', 'ly.img.spacer', 'ly.img.zoomFit.canvasBar' ], 'top');Here we create a custom Canvas Bar for the bottom position with the settings button, a separator, the export button, spacers, and a theme switcher button.
Layout Helpers#
CE.SDK provides two layout helper components to organize Canvas Bar content:
// Using layout helpers: spacers and separatorsconst updatedOrder = cesdk.ui.getCanvasBarOrder('bottom');console.log('Updated bottom Canvas Bar order:', updatedOrder);
// Insert a separator before the export buttoncesdk.ui.insertCanvasBarOrderComponent( 'ly.img.export.canvasBar', 'ly.img.separator', 'bottom', 'before');ly.img.separator adds a vertical divider line with smart rendering rules:
- Adjacent separators render as one
- Separators at edges are hidden
- Separators adjacent to spacers (on the left) are hidden
ly.img.spacer distributes horizontal space evenly. Multiple spacers share the available space proportionally.
Edit Mode Context#
The content of the Canvas Bar changes based on the current edit mode ('Transform' (the default), 'Text', 'Crop', 'Trim', or a custom value), so all APIs accept an orderContext argument to specify the mode.
Each Canvas Bar position ('top' or 'bottom') has its own component order. All ordering APIs require a position parameter and accept an optional orderContext to target specific edit modes.
// Configure different Canvas Bar for Text edit mode// Reference the registered bold button by its IDcesdk.ui.setCanvasBarOrder( [ 'ly.img.settings.canvasBar', 'ly.img.separator', 'ly.img.boldText.canvasBar', 'ly.img.spacer', 'ly.img.export.canvasBar' ], 'bottom', { editMode: 'Text' });In this example, we configure a different Canvas Bar for Text edit mode that includes a bold button relevant for text editing.
API Reference#
| Method | Purpose |
|---|---|
cesdk.ui.registerComponent(id, renderFunction) | Register a custom component |
cesdk.ui.getCanvasBarOrder(position, orderContext?) | Get current component order |
cesdk.ui.setCanvasBarOrder(order, position, orderContext?) | Set complete component order |
cesdk.ui.updateCanvasBarOrderComponent(matcher, update, position, orderContext?) | Update matched components |
cesdk.ui.removeCanvasBarOrderComponent(matcher, position, orderContext?) | Remove matched components |
cesdk.ui.insertCanvasBarOrderComponent(matcher, component, position, location?, orderContext?) | Insert components |