SVG

external class SVG

SVG document used to manipulate icon content.

The constructor parses and validates content. After modifying the parsed tree, call load again when you need to re-parse the document.

Constructors

Link copied to clipboard
constructor(content: String)

Parse an SVG document. Throws when the content is not a single <svg> element or has neither a valid viewBox nor valid width and height.

Properties

Link copied to clipboard
var $svg: dynamic

Parsed SVG root element.

Link copied to clipboard

ViewBox as { left, top, width, height }.

Functions

Link copied to clipboard

Get the inner content of the SVG.

Link copied to clipboard

Get the icon as Iconify icon data: viewBox dimensions plus body.

Link copied to clipboard
fun load(content: String)

Parse and replace the SVG contents.

Link copied to clipboard
fun toMinifiedString(customisations: IconifyIconCustomisations? = definedExternally): String

Get the SVG as a string without pretty printing.

Link copied to clipboard
fun toPrettyString(customisations: IconifyIconCustomisations? = definedExternally): String

Get the SVG as a pretty-printed string.

Link copied to clipboard
fun toSvgString(customisations: IconifyIconCustomisations? = definedExternally, prettyPrint: Boolean = definedExternally): String

Get the SVG as a string.