Module

Svg.Parser.Halogen

Package
purescript-svg-parser-halogen
Repository
rnons/purescript-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 Source

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

Convert Element to HTML.

#svgElementToHtmlWithAttrs Source

svgElementToHtmlWithAttrs :: forall i r p. 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 Source

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

Convert SvgNode to HTML.

#parse Source

parse :: forall i p. 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 Source

icon :: forall i r p. 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.