Module

Svg.Parser.Halogen

A module to convert SvgNode to halogen HTML. Normally you should only need the icon function. See demo for an example.

#svgElementToHtml

svgElementToHtml :: forall p i. Element -> HTML p i

Convert Element to HTML.

#svgElementToHtmlWithAttrs

svgElementToHtmlWithAttrs :: forall p r i. Element -> Array (IProp r i) -> HTML p i

Similar to svgElementToHtml, but you can add additional attributes to it. Useful to apply className or bind event listeners.

#svgNodeToHtml

svgNodeToHtml :: forall p i. SvgNode -> HTML p i

Convert SvgNode to HTML.

#parse

parse :: forall p i. String -> Either String (HTML p i)

If you don't want to deal with the SvgNode type, you can use this function to parse a String as HTML directly.

#icon

icon :: forall p r i. String -> Array (IProp r i) -> HTML p i

This helper function should be enough for the use case of inline SVG icons. It takes an SVG source String and an array of IProp. The output is an inlined SVG icon with additional className, style or event listeners.

Modules