Cannot pass HTMLElement as icon when adding new rte action
You've accurately identified a type mismatch in GrapesJS regarding the icon property for Rich Text Editor (RTE) actions. The RichTextEditor.addAction method is indeed designed to accept both string (for SVG paths or class names) and HTMLElement instances for the icon property, but the TypeScript definition for RichTex...
Read full answer below βQuestion
GrapesJS version [X] I confirm to use the latest version of GrapesJS What browser are you using? Chrome Reproducible demo link https://jsfiddle.net/vmeywbk8/11/ Describe the bug Just a small type issue we came across - when adding an action to the RichTextEditor, the "icon" property of RichTextEditorAction is marked as string. But in addAction (https://github.com/GrapesJS/grapesjs/blob/793599cbd5493c0104db1134bd4b1684341274a7/src/richtexteditor/model/RichTextEditor.ts#L363) if we pass in a HTMLElement, it will be appended to the button. This still works fine at runtime, but you will get a typ...
Answers (1)
You've accurately identified a type mismatch in GrapesJS regarding the icon property for Rich Text Editor (RTE) actions. The RichTextEditor.addAction method is indeed designed to accept both string (for SVG paths or class names) and HTMLElement instances for the icon property, but the TypeScript de...
Related Questions and Answers
Continue research with similar issue discussions.
Issue #6409
Cannot drag to move components on mobile
GrapesJS version [x] I confirm to use the latest version of GrapesJS What browser are you using? Chrome v133 Reproducible demo link https:/...
Issue #5379
Class modifications of components are not automatically detected
GrapesJS version[X] I confirm to use the latest version of GrapesJSWhat browser are you using? Chrome Version 116Reproducible demo link htt...
Issue #5328
Editable text after remove focus of RTE, returns back previous state of content.
GrapesJS version [X] I confirm to use the latest version of GrapesJS What browser are you using? Chrome Reproducible demo link https://jsfi...
Issue #4449
Lists not working with default RTE
GrapesJS version [X] I confirm to use the latest version of GrapesJS What browser are you using? Chrome Version 102.0.5005.115 (Official Bu...
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
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.
Tutorial
π Introducing the New GrapesJS Plugin Generator on GJS.Market
Weβre excited to announce a powerful new tool for GrapesJS developers β the GrapesJS Plugin Generator on GJS.Market!
Tutorial
Integrating GrapesJS into a Vue 3 App β Complete Guide for 2026
Build a Vue 3 landing page builder with GrapesJS and Vite. Custom blocks, composables, remote storage, TypeScript & production tips. Updated for 2026.
Browse Plugin Categories
Jump directly to plugin category pages on the marketplace.