grapesjs

How to put custom icon inside GrapesJs panel button?


My code:

const sidebarTools = panelManager.addPanel({
id: "sidebar-panel",
el: ".sidebar__tools",
buttons: [
  {
    id: "add-block",
    className: "tool__add-block",
    label: "Add Block",
    command: "show-blocks",
  },
],
});

I need to put my icon inside <span class="gjs-pn-btn tool__add-block">Add Block</span> instead of Add block label. How can i do it? If it's possible i want to add icon through src


Solution

  • label: '<img src="frontend/icons/add-block.svg">',
    

    it worked