Toolbar โ
The toolbar in PageBuilderJS allows you to define actions and tools that enhance the user experience inside the editor. You can provide custom buttons and tabs to interact with the page content, modules.
๐งฐ Toolbar Structure โ
Toolbar configuration is a simple object composed of tabs and tools.
Toolbar Type โ
ts
export type Toolbar = {
tabs: {
id: string;
title: string;
icon?: string;
tools: string[];
}[];
};Toolbar Tab Attributes โ
id: stringโ Unique identifier for the tab. Used internally.title: stringโ Label displayed in the toolbar UI.icon?: stringโ Optional icon for the tab. Can be a predefined icon from list or a URL to an image.tools: string[]โ Array of tool IDs (these must match IDs from definedModules).
๐งช Example: Toolbar with Module Tools โ
Here's a complete example of a toolbar definition using tools related to the modules from the Modules section:
ts
{
tabs: [
{
id: 'general',
title: 'General',
icon: 'CheckIcon',
tools: ['button', 'title', 'list']
},
{
id: 'layout',
title: 'Layout',
icon: 'CheckIcon',
tools: ['space', 'column']
},
]
}๐ง Tips โ
- Use consistent
idvalues for tools and tabs - Icons can be a icon from list or a URL to an image
- Tools are dynamically passed the selected instance