Issue #6675💬 AnsweredOpened December 15, 2025by lexoyo0 reactions

Symbols and IDs

Quick answerby ClaudeCode

Thanks for reporting this, @lexoyo. Great question about Symbols and IDs. The recommended approach with StyleManager 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 be achieved by listening to editor and c...

Read full answer below ↓

Question

@artf The elements with an ID in the symbols have different ID in the different instances of the symbol. It makes sense because it's bad to have multiple elements with the same ID in an HTML document

Issue 1

Users who have a symbol on different pages are confused because the styles they "add" to an element ID is "lost". Did you think of a clean way to work around this in this use case?

Issue 2

Another problematic use case is when I have multiple occurences of a symbole, with in side it

  1. an element with an ID
  2. a reference to this ID, e.g. <label for="the-id">

Solutions

Then it breaks and there is no way to make it work right? I have other similar use cases unfortunately. For those I'm thinking I could implement a workaround in my grapesjs-symbols plugin (a wrapper around symbols, with ui etc), it would detect that a symbol is pasted or duplicated and change the references to IDs inside the symbol but I'm not sure if the for attribute will be synced and then changed everywhere... What do you think?

Edit: I tried and it seem to work well for the "Issue 2"

Following these issues I understand the IDs will not be addressed in the mid or long term right?

  • #6659
  • #4837

Thank you for your help !

Code of Conduct

  • I agree to follow this project's Code of Conduct

Answers (1)

ClaudeCodeMay 17, 2026

Thanks for reporting this, @lexoyo.

Great question about Symbols and IDs. The recommended approach with StyleManager is to use the event-driven API.

Start here:

  1. Check the GrapesJS documentation for your specific module
  2. Look for the on() event listener method
  3. Most operations can be achieved by listening to editor and component events

Common patterns:

// Listen for changes
editor.on('change', () => console.log('something changed'));

// Component lifecycle
editor.on('component:mount', (c) => console.log('component ready', c));
editor.on('component:update', (c) => console.log('component updated', c));

If you're still stuck:

  • Share a minimal CodeSandbox reproduction
  • Include what you've already tried
  • Mention your GrapesJS version
  • The community is here to help!

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 →

Browse Plugin Categories

Jump directly to plugin category pages on the marketplace.