Issue #2825đź’¬ AnsweredOpened June 11, 2020by Leozinho02 reactions

How do I add my classes CSS file when using components?

Quick answerby RJCAM❤ 1

Hi, @Leozinho0 You can do it like this:

Read full answer below ↓

Question

I have this component: editor.BlockManager.add('rodape', { label: '3 Colunas', content: { tagName: 'div', draggable: true, attributes: { class: 'row' }, style: { 'display': 'flex', 'justify-content': 'flex-start', 'align-items': 'stretch', 'flex-wrap': 'nowrap', 'padding': '10px', }, content: 'lala' } }); I want to use the class ROW but where do I define this class? When I drag this component block inside the canvas the CSS of the class is not even loaded.

Answers (3)

RJCAM• June 11, 2020

Hi, @Leozinho0 You can do it like this:

RJCAM• June 12, 2020

Actually, the code I give to you works, to see what I mean, try this:Drop custom created component into canvas, as you said it won't load the css ".row" styleNow drop any column block inside the canvas, and now you see the ".row" css is loaded. This is because the styles are inside the block itself...

Leozinho0• June 11, 2020

Hi. Thank you for answering. It doesn't work.

If you check https://grapesjs.com/demo.html when you add a component (Ex.: 3 columns) and click to export the html you will see that it loads the .row and .cell classes.

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.