Issue #908💬 AnsweredOpened February 28, 2018by sbarfurth0 reactions

Add custom classes to panels and other editor elements

Quick answerby artf

You can set attributes in this way

Read full answer below ↓

Question

When using a UI framework that provides custom classes, it would be nice to be able to use these classes on things like panels, so you wouldn't have to rewrite the CSS. A possible syntax may be: It would also be useful to be able to do this after the fact for presets, using a setter for example. I could not find a way to do this yet, specifically for panels. Though I would consider this useful for any editor UI element.

Answers (2)

artfMarch 2, 2018

You can set attributes in this way

editor.Panels.addPanel({
	id: 'myNewPanel',
	...
	attributes: {'data-stuff': 'val1', 'classe': 'val2'}
})
lock[bot]September 18, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

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.