Issue #2435💬 AnsweredOpened November 29, 2019by edwinjoel19840 reactions

Styles by ID in components

快速解答by artf

You can toggle classes, this will change the style selector

Read full answer below ↓

Question

How do I make the styles of the components I take them by id and not by class

Answers (2)

artfNovember 30, 2019

You can toggle classes, this will change the style selector Schermata 2019-11-30 alle 00 12 32

edwinjoel1984December 2, 2019

The main problem that i have is I'm trying to do a resize in a component that I made, but if I have Two Components equals, when I do the resize one of them the other do the same resize. So, I think that I would need manage the style of them by id and not by class.

代码片段TEXT
This is my code: 
`const buttonComponent = {
    name: "button-bk",
    data: {
      id: "button",
      label: `Button`,
      category: "Basic Components",
      draggable: true,
      content: `<button class="btn-builder" data-gjs-draggable=".cell" data-gjs-resizable='{"tl":0,"tc":0,"tr":0,"cl":0,"cr":1,"bl":0,"br":0,"minDim":1,"bc":0,"currentUnit":1,"step":0.2}' data-gjs-name="Button">Send</button>`,
    },
  };
editor.BlockManager.add('button', buttonComponent);
`
View Example https://cl.ly/c4bfaf626adc

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.