Search Docs
Loading...
Skip to content

Canvas Bar

The canvas bar is the floating toolbar that appears above or below the canvas. This guide covers canvas bar-specific features like the dual-position system, edit mode context, layout helpers, and the default component order.

Canvas bar customization showing top and bottom position layouts

10 mins
estimated time
Download
StackBlitz
GitHub

For general component manipulation (reordering, inserting, removing), see the Component Order API Reference.

This guide covers showing and hiding the canvas bar, configuring the dual-position system, setting edit mode-specific layouts, using layout helper components, and viewing the default component order.

Show or Hide the Canvas Bar#

Use the Feature API to control canvas bar visibility:

// Hide the canvas bar
cesdk.feature.disable('ly.img.canvas.bar');
// Show the canvas bar (default)
cesdk.feature.enable('ly.img.canvas.bar');

For more on the Feature API, see Show/Hide Components.

Position System#

Unlike other UI areas, the canvas bar has two independent positions: 'top' and 'bottom'. All Component Order API calls require the at option to specify which position to configure.

// Configure the top position with settings and add page
cesdk.ui.setComponentOrder({ in: 'ly.img.canvas.bar', at: 'top' }, [
'ly.img.settings.canvasBar',
'ly.img.separator',
'ly.img.page.add.canvasBar'
]);
// Configure the bottom position independently
cesdk.ui.setComponentOrder({ in: 'ly.img.canvas.bar', at: 'bottom' }, [
'ly.img.spacer',
'ly.img.page.add.canvasBar'
]);

Each position maintains its own component order. Changes to the top position do not affect the bottom position and vice versa.

Edit Mode Context#

The canvas bar supports different component orders for different edit modes. Use the when option combined with at to define layouts that activate only in a specific mode.

// Set a text formatting toolbar for Text edit mode at the top position
cesdk.ui.setComponentOrder(
{ in: 'ly.img.canvas.bar', at: 'top', when: { editMode: 'Text' } },
[
'ly.img.text.bold.canvasBar',
'ly.img.text.italic.canvasBar',
'ly.img.separator',
'ly.img.settings.canvasBar'
]
);

Available edit modes: 'Transform' (default), 'Text', 'Crop', 'Trim', or any custom value. Edit modes without specific configurations fall back to the Transform mode order. See the Component Order API Reference for details on the when context.

Layout Components#

The canvas bar uses two layout helper components to organize content:

// Use spacers and separators to control layout
cesdk.ui.setComponentOrder({ in: 'ly.img.canvas.bar', at: 'bottom' }, [
'ly.img.settings.canvasBar',
'ly.img.separator',
'ly.img.spacer',
'ly.img.page.add.canvasBar',
'ly.img.spacer'
]);
Component IDDescription
ly.img.separatorVertical divider line with smart rendering (hides when adjacent to edges or spacers)
ly.img.spacerFlexible space that distributes remaining horizontal space evenly

Multiple spacers share available space proportionally, allowing you to center or push components to specific positions.

Default Component Order#

Retrieve the current canvas bar order with getComponentOrder to inspect the default layout. The at option is required. For detailed descriptions of each component ID, see the Component Reference.

// Retrieve and log the current canvas bar order for each position
const topOrder = cesdk.ui.getComponentOrder({
in: 'ly.img.canvas.bar',
at: 'top'
});
console.log('Current top canvas bar order:', topOrder);
const bottomOrder = cesdk.ui.getComponentOrder({
in: 'ly.img.canvas.bar',
at: 'bottom'
});
console.log('Current bottom canvas bar order:', bottomOrder);

Top Position#

The top position is empty by default.

Bottom Position (Default)#

Component IDDescription
ly.img.settings.canvasBarOpens settings panel
ly.img.spacerFlexible space
ly.img.page.add.canvasBarAdds new page
ly.img.spacerFlexible space

Text Edit Mode Components#

Component IDDescription
ly.img.text.bold.canvasBarToggle bold
ly.img.text.italic.canvasBarToggle italic

Troubleshooting#

  • Component Order API fails - Ensure you include the required at: 'top' or at: 'bottom' option. The canvas bar is the only UI area that requires a position.
  • Edit mode order not applying - Check that the when: { editMode: '...' } value matches exactly (case-sensitive).
  • Canvas bar not visible - Ensure cesdk.feature.disable('ly.img.canvas.bar') hasn’t been called elsewhere.

Next Steps#