Can't set background:none in mobile version using styles panel
not a bug but a missing feature, we'll need to extend the stack type with a new configuration for "empty" values. I'll try to bring it in the next version.
Read full answer below ↓Question
GrapesJS version
- I confirm to use the latest version of GrapesJS
What browser are you using?
Edge last version
Reproducible demo link
Describe the bug
How to reproduce the bug?
- Open demo link
- Click on Header
- Change view to mobile or tablet.
- Try to remove background from header.
What is the expected behavior? That editor set header with background:none
@media (max-width: 480px){
.header-banner{
background:none;
}
}
What is the current behavior? GrapesJS inherit from the ‘desktop’ version, so it's impossible to remove background from mobile version.
It happens using 'background' stack version and 'background-image' alone version.
Code of Conduct
- I agree to follow this project's Code of Conduct
Answers (4)
not a bug but a missing feature, we'll need to extend the stack type with a new configuration for "empty" values. I'll try to bring it in the next version.
the clear icon from de property Background removes completely the properties from the selected device making it inherit again the values from the desktop settings.
Correct
the clear icon in the layer line resets the stack values, setting the properties for the selected device to its default values, removing the background and not inheriting from the desktop settings. Clicking again in the same clear icon will remove the layer completely.
I'm not sure if that's exactly what I have in mind but the idea is to make it work as it is but with an additional logic, when I remove the last layer, I'll apply the new property, if exists (eg. emptyValue).
That is a possible property type
emptyValue?: string | () => PropValues;
In the case of string
emptyValue: 'unset',
I'll update the style target properties with that value { background-image: unset, background-size: unset, ... }
Or I can decide to generate the style properties directly (in case of more advanced usage)
emptyValue: () => ({
'background-image': 'unset',
'background-size': 'other value',
// ...
}),
I've inserted a solution for the stack type. I'm going to make a PR but I would like to ask you something first. The behavior i'm adding is:
- the clear icon in the layer line resets the stack values, setting the properties for the selected device to its default values, removing the background and not inheriting from the desktop settings. Clicking again in the same clear icon will remove the layer completely.
- the clear icon from de property Background removes completely the properties from the selected device making it inherit again the values from the desktop settings.
This is the behavior i'm applying to our version of the grapes. If you think that this should be de standard behavior i can make the PR later What do you say?
Thanks for reporting this, @ronaldohoch.
Great question about Can't set background:none in mobile version using styles panel. 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 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.
Issue #5263
Deleting a component without deleting its corresponding style, will adding new components later cause style conflicts?
GrapesJS version [X] I confirm to use the latest version of GrapesJS What browser are you using? latest version of Chrome Reproducible demo...
Issue #4448
Error on resize image.
GrapesJS version [X] I confirm to use the latest version of GrapesJS What browser are you using? Brave Browser Last version Reproducible de...
Issue #4208
Style click state bug in every element
GrapesJS version [X] I confirm to use the latest version of GrapesJS What browser are you using? Brave Last, tested on chrome last and Safa...
Issue #6549
Couldnt Resize image
GrapesJS version [x] I confirm to use the latest version of GrapesJS What browser are you using? Chrome Reproducible demo link https://code...
Paid Plugins That Match This Issue
Curated by issue keywords and label relevance to help you ship faster.
Loading paid plugin recommendations...
Check the open-source GrapesJS plugins on GitHub or run a quick search in our free catalog.
Browse free plugins →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.
Tutorial
Find the Right GrapesJS Plugin in Seconds: Smarter Discovery Is Live
We're shipping a set of discovery upgrades. New label filters, a proper compatibility switch for GrapesJS vs Studio, one-click and a smarter sort bar.
Tutorial
GrapesJS vs Webflow vs Tilda: What to Choose for Your Business in 2026
Choosing the right website platform in 2026 is no longer just about building a site
Tutorial
GJS Market 2.0 - Donations, Tracking, Labels and Better Product Discovery
We’ve rolled out a new set of GrapesJS marketplace updates across GJS Market, focused on improving how creators distribute products
Browse Plugin Categories
Jump directly to plugin category pages on the marketplace.