How to add custom style at svg element
See original GitHub issueI want add custom style into svg element when compile it. Because svg is not aligned with text by default
My config file like this
module.exports = {
outDir: 'src/components',
ref: true,
icon: true,
typescript: true,
svgProps: {
focusable: { }, // ✅ this attruibute add correctly
style: { verticalAlign: '-0.125em' }, // ❌ align svg element with text or inline element
},
};
Does svgr support passing object as svg props?
Issue Analytics
- State:
- Created a year ago
- Comments:8 (2 by maintainers)
Top Results From Across the Web
<style> - SVG: Scalable Vector Graphics - MDN Web Docs
The SVG <style> element allows style sheets to be embedded directly within SVG content. Note: SVG's style element has the same attributes as...
Read more >How to apply a style to an embedded SVG? - Stack Overflow
This way, the SVG will be inlined, and you can easily apply styles using CSS. This custom element will work just like the...
Read more >Styling — SVG 2
The 'style' element allows style sheets to be embedded directly within SVG content. SVG's 'style' element has the same attributes as the corresponding...
Read more >SVG Properties and CSS
Presentation attributes are used to style SVG elements and can be used as CSS properties. Some of these attributes are SVG-only while others ......
Read more >SVG and CSS - Cascading Style Sheets - Jenkov.com
It is possible to style your SVG shapes using CSS. By styling is meant to change the looks of the shapes. This can...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Can be added with svgo’s
addAttributesToSVGElement
plugin. Like this:add config as below into your
svgr.config.js
, you can custom style at svg element. Maybe you can try the above method,it is more perfect