Unable to use transparent fill in Block media svg
I believe it depends on the specific SVG being used. If you check the other SVG icons, you'll notice they don't have a fill attribute (inline) on the main <svg> tag but rather on the child <path> tags. By setting the fill="none" attribute on the two <path> elements of this SVG, the icon should display properly. I hope...
Read full answer below โQuestion
GrapesJS version[X] I confirm to use the latest version of [email protected] when this issue was filedWhat browser are you using? Firefox 132, Chrome 131Reproducible demo link https://jsfiddle.net/x54f9v68/1/Describe the bug How to reproduce the bug?Add a custom block, with the media property set to an SVG with a transparent fillCheck the blocks tab, and notice the fill is automatically set to currentColor What is the expected behavior? Fill should be transparent What is the current behavior? Fill inheritscurrentColor, which incorrectly renders the icon Looks like fill is set to current...
Answers (4)
I believe it depends on the specific SVG being used. If you check the other SVG icons, you'll notice they don't have a fill attribute (inline) on the main <svg> tag but rather on the child <path> tags. By setting the fill="none" attribute on the two <path> elements of this SVG, the icon should disp...
@samex Specifying fill="none" did the trick, thanks! That'll deffo help get my custom stuff working more predictably. Past that, I think the main pain point would be trying to use third-party SVGs (e.g. "react-icons") or wysiwyg output that doesn't explicitly set the fill attributes. With those use...
Yeah I'd close this one as it's not strictly related to the core itself but thanks for point this out
The issue you're encountering with transparent SVG fills in GrapesJS block media is a known behavior stemming from the editor's default styling. You've correctly identified the root cause: GrapesJS applies a fill: currentColor; style to all SVGs within the .gjs-block elements in the blocks panel. T...
Related Questions and Answers
Continue research with similar issue discussions.
Issue #6659
Symbol styles not synced
GrapesJS version [x] I confirm to use the latest version of GrapesJS What browser are you using? Firefox 145.0 (64-bit) Reproducible demo l...
Issue #6515
Resizing an element affects all elements with the same class
GrapesJS version [x] I confirm to use the latest version of GrapesJS What browser are you using? Chrome 136.0.7103.93 Reproducible demo lin...
Issue #5424
`component:styleUpdate` event is not fired
GrapesJS version[X] I confirm to use the latest version of GrapesJSWhat browser are you using? Chrome 116.0.5845.187Reproducible demo link...
Issue #4294
Unable to drop textable components into small text areas
GrapesJS version [X] I confirm to use the latest version of GrapesJS What browser are you using? Chrome v100 Reproducible demo link https:/...
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
How to Build a Production GrapesJS Editor: The Complete Walkthrough of Brief, Preset, Plugins, and Services
A complete walkthrough of building a production GrapesJS editor: how to choose a preset, pick plugins, and scope setup services without burning a sprint.
Tutorial
Big Updates: TinyMCE 8 and Placeholder 2.0 for GrapesJS
In May we shipped major updates to two of our most popular GrapesJS plugins โ TinyMCE Inline Text Editor and Placeholder.
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.
Browse Plugin Categories
Jump directly to plugin category pages on the marketplace.