Not sure how others use SVG assets, but in my case, I had to trim the whitespace myself, so that the width / height of an image would correspond to the same width / height of its contents. Handy way to trim the whitespace is to just open an SVG image in any browser, run this in the console:
const x = document.getElementsByTagName("svg")[0].getBBox();
console.log(`${x.x} ${x.y} ${x.width} ${x.height}`);
And copy the output into viewBox attribute of the SVG tag.
I've added the whitespace by design because then I get consistent layout of icons but it could prolly be a good idea to remove it to be more flexible in terms of use cases.
Not sure how others use SVG assets, but in my case, I had to trim the whitespace myself, so that the width / height of an image would correspond to the same width / height of its contents. Handy way to trim the whitespace is to just open an SVG image in any browser, run this in the console:
And copy the output into
viewBox
attribute of the SVG tag.