How to add a custom button with custom command in default panel of grapesjs
Use editor.Panels.getPanels() to get all the available panels and then use addButtons method shown below.Here 'options' is the panel name editor.Panels.addButton('options', [ { id: 'save', className: 'fa fa-floppy-o icon-blank', command: function(editor1, sender) { alert('Hello World') }, attributes: { title: 'Save Te...
Read full answer below ↓Question
I have integrated grapesjs with angular6. and i am getting a default panel with a select box appearing at top of screen; i want a custom button with my own custom command on the default panel. i want to add a button looks like below marked by red color.

i want to when i click on the button then an alert box should be displayed on the screen with hello world message. please let me know how can i add my custom button on default panel
Answers (3)
Use editor.Panels.getPanels() to get all the available panels and then use addButtons method shown below.Here 'options' is the panel name editor.Panels.addButton('options', [ { id: 'save', className: 'fa fa-floppy-o icon-blank', command: function(editor1, sender) { alert('Hello World') }, attribute...
I also had trouble with that when had tried to button to Panel. So, I used the following way: editor.Panels.addButton('#target panel id#', { id: 'alert-button', className: 'btn-alert-button', label: 'Click my butt(on)', command(editor) { alert('Hello World'); } active: true }); However, the panel a...
This is well documented at https://grapesjs.com/docs/getting-started.html#panels-buttons. You have two methods to add a panel with buttons: (1) When initializing GrapesJS, (2) After GrapesJS was initialized with addPanel. Please note that this is for a panel that you have defined with <div id='basi...
Related Questions and Answers
Continue research with similar issue discussions.
Issue #2350
[Question] How do I add elements/sectors to views container using a custom button in the Panel
I have added a custom button to the Panel as below: const pm = editor.Panels; pm.addButton('views', { id: 'customButton', className: '', co...
Issue #386
Extend Pannel/Command examples/documentation with opening a new view
Hi Artur, First of all grapesjs is awsome! At the moment i am trying to puzzle together how to create a pannel with a button that opens a n...
Issue #482
Default asset manager in custom component
I am in process to create custom component for below template and we want to have user enter text,link,hover text and select image and want...
Issue #3231
how to change gjs-ckeditor-format component
hi guys, we all know that gjs-ckeditor-plugin working with [data-gjs-type]="text" components. I wanna know , could we change this option? I...
Paid Plugins That Match This Issue
Curated by issue keywords and label relevance to help you ship faster.
Loading paid plugin recommendations...
Check the open-source GrapesJS plugins on GitHub or run a quick search in our free catalog.
Browse free plugins →Premium plugins ship with support, regular updates, and production-ready features — save days of integration work.
Browse premium plugins →Related tutorials
In-depth guides on the same topic.
Tutorial
How to Build a Production GrapesJS Editor: The Complete Walkthrough of Brief, Preset, Plugins, and Services
A complete walkthrough of building a production GrapesJS editor: how to choose a preset, pick plugins, and scope setup services without burning a sprint.
Tutorial
Embed GrapesJS in Your SaaS: A Weekend Guide
Embed GrapesJS in your SaaS and ship a white-label page builder over a weekend. Honest tradeoffs, real code, and the plugins that close the UX gap.
Tutorial
Big Updates: TinyMCE 8 and Placeholder 2.0 for GrapesJS
In May we shipped major updates to two of our most popular GrapesJS plugins — TinyMCE Inline Text Editor and Placeholder.
Browse Plugin Categories
Jump directly to plugin category pages on the marketplace.