Issue #5357πŸ’¬ AnsweredOpened Sep 3, 2023by peters-ben-00070 reactions

Cannot pass HTMLElement as icon when adding new rte action

Quick answerby GJS Helper

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)

GJS Helperβ€’ May 17, 2026

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.

Paid Plugins That Match This Issue

Curated by issue keywords and label relevance to help you ship faster.

View all plugins

Loading paid plugin recommendations...

Free option

Check the open-source GrapesJS plugins on GitHub or run a quick search in our free catalog.

Browse free plugins β†’
Premium option

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.

All tutorials β†’

Browse Plugin Categories

Jump directly to plugin category pages on the marketplace.