NssSvgReplacer
Last updated
Was this helpful?
Last updated
Was this helpful?
This component replaces all SVG images with inline SVG code. So you can use CSS to style the SVG images.
For NssUiApi
usage, please see the of the nss_libs/ui
folder.
Alternative example of direct ES6 module import:
That's it. All existing and upcoming added SVG images will be replaced with inline SVG code.
Important:
width
and height
attributes will be removed on the SVG element.
preserveAspectRatio="none"
can be added to allow the SVG element to stretch to the viewport of the SVG element.
Attributes like class
, style
, id
, data-*
will be copied to the SVG element.
mask-image
Loads the given URL (if it's SVG file) and adds it to the CSS mask-image
(-webkit-mask-image
) property of the element.
Important:
preserveAspectRatio="none"
will be automatically added to allow stretching via CSS.