Issue #4466๐Ÿ’ฌ AnsweredOpened Jul 20, 2022by capoia1 reactions

Change in traits does not update html

Quick answerby skruโค 1

first, you're code needs to go in a plugin https://grapesjs.com/docs/modules/Components.html#define-custom-component-type and you're not updating the model of the component, just the html in the canvas... https://jsfiddle.net/jmweg8u1/4/

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/weellingtonc/t8hs9f67/2/ Describe the bug How to reproduce the bug?add 'button-cube' component to workspaceclick on the created buttongo to the settings component and change the value of the "texto do botao" propertyopen the option to view the generated html What is the expected behavior? When updating the trait it would also generate a new html What is the current behavior? It keeps the initial state of the button, with the old text Note: this ha...

Answers (3)

skruโ€ข Jul 21, 2022

first, you're code needs to go in a plugin https://grapesjs.com/docs/modules/Components.html#define-custom-component-type and you're not updating the model of the component, just the html in the canvas... https://jsfiddle.net/jmweg8u1/4/

artfโ€ข Jul 22, 2022

Yeah correct, thanks @skru You can also connect the content directly to the trait to read also the initial value.

traits: [{ label: 'Texto do botรฃo', type: 'text', name: 'content', changeProp: true }],
GJSBlockโ€ข May 17, 2026

Thanks for reporting this, @capoia. Great question about Change in traits does not update html. The recommended approach with Components is to use the event-driven API. Start here: Check the GrapesJS documentation for your specific module Look for the on() event listener method Most operations can...

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.