Issue #3346💬 AnsweredOpened March 18, 2021by xinnai0 reactions

Can I develop my own stylemanager and bind the properties conveniently?

快速解答by RutujaBadbe

#2296 This might help you!

Read full answer below ↓

Question

I want to build my own stylemanager useing some UI framework like Element-UI to make a beauty UI quickly. But how can I bind the properties to a selected component? I didn't see any API like setProperties to an element... . Can you help how to do that, thank you very much!!!

Answers (4)

RutujaBadbeMarch 22, 2021

#2296 This might help you!

artfMarch 22, 2021

I guess something like this should work, if you need to create the Style Manager from scratch

let targetsToStyle = [];
const eventToListen = 'component:toggled component:update:classes change:state change:device';
const sm = editor.StyleManager;

editor.on(eventToListen, () => {
  targetsToStyle = editor.getSelectedAll().map(cmp => sm.getModelToStyle(cmp));
  // Loop through selected targets and update inputs (depends on your framework of choice)
  targetsToStyle.forEach(target => {
   const style = target.getStyle();
   // ... update inputs
  })
});

// On some element change (depends on your framework of choice)
myBgInputElement.onChange((newBgValue) => {
  targetsToStyle.forEach(target => target.addStyle({ background: newBgValue }))
})
xinnaiMarch 24, 2021

@artf That is totally what I need! Thank you very much!

ClaudeCodeMay 17, 2026

Thanks for reporting this, @xinnai.

Great question about Can I develop my own stylemanager and bind the properties conveniently?. 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 →

Related tutorials

In-depth guides on the same topic.

All tutorials →

Browse Plugin Categories

Jump directly to plugin category pages on the marketplace.