Issue #6685๐Ÿ’ฌ AnsweredOpened Jan 12, 2026by shery0 reactions

Custom component styles are not applied after deletion and re-addition

Quick answerby mdmontesinos

I'm facing a similar issue, where the re-added component has the correct styles property: <img width="1112" height="17" alt="Image" src="https://github.com/user-attachments/assets/474011c4-b1be-48df-9aa8-14c3dcdfc68d" /> But if I use the "View Code" button, the CSS was not injected, in my case they aren't even in the...

Read full answer below โ†“

Question

GrapesJS version [x] I confirm to use the latest version of GrapesJS What browser are you using? Chrome v143.0.7499.193 Reproducible demo link https://codesandbox.io/p/sandbox/2l3887 Describe the bug How to reproduce the bug? Open the page and load the GrapesJS editor Select the Row component and delete it Click the Row component in the left sidebar to add a Row to the canvas What is the expected behavior? The newly added Row component should display correct styles (white background, border, border-radius, padding, etc.) What is the current behavior? After re-adding the Row component, the .gj...

Answers (4)

mdmontesinosโ€ข Feb 17, 2026

I'm facing a similar issue, where the re-added component has the correct styles property: <img width="1112" height="17" alt="Image" src="https://github.com/user-attachments/assets/474011c4-b1be-48df-9aa8-14c3dcdfc68d" /> But if I use the "View Code" button, the CSS was not injected, in my case they...

artfโ€ข Feb 18, 2026

@mdmontesinos your usage is not correct, styles has to be defined at the component definition, and it's not expected to change. Also, it's wrong to use IDs for component definition if the component is expected to be reused, the ID will be recreated, rely on classes, especially for styles. But the r...

mdmontesinosโ€ข Feb 18, 2026

@artf I'm using an ID because there will always be a single instance of that component in my project. My use case is that a component is designed externally to be used as a "background" and then imported into projects that use it. Therefore, when the external component is updated, I need to also up...

GJS Helperโ€ข May 17, 2026

This is a common issue encountered when defining static, type-level styles directly within a custom component's styles property in GrapesJS. The behavior you're observing is not strictly a bug in GrapesJS's core functionality, but rather a consequence of how its internal style manager optimizes and...

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.