This file is organized roughly in order of popularity. The tags which you'd expect to use frequently will be closer to the top.
Convert to a string with indentation.
Setting indentation to 0 will additionally remove newlines between tags, sort of
like Json.Encode.encode 0.
import Svg.String.Attributes exposing (g, rect, stroke)
someHtml : Html msg
someHtml =
svg [ height "68px" ] [ g [] [ rect [ x "10", y "20", stroke "red" ]]]
Svg.String.toString 2 someHtml
-->"<svg height=\"68px\">\n <g>\n <rect x=\"10\" y=\"20\" stroke=\"red\">\n </rect>\n </g>\n</svg>"
Svg.String.toString 0 someHtml
--> "<svg height=\"68px\"><g><rect x=\"10\" y=\"20\" stroke=\"red\"></rect></g></svg>"The core building block to create SVG. This library is filled with helper
functions to create these Svg values.
This is backed by VirtualDom.Node in evancz/virtual-dom, but you do not
need to know any details about that to use this library!
The core building block used to build up HTML.
Set attributes on your Svg.
A simple text node, no tags at all.
Warning: not to be confused with text_ which produces the SVG <text> tag!
Create any SVG node. To create a <rect> helper function, you would write:
rect : List (Attribute msg) -> List (Svg msg) -> Svg msg
rect attributes children =
node "rect" attributes childrenYou should always be able to use the helper functions already defined in this library though!
Transform the messages produced by some Svg.
Convert to regular
elm/htmlHtml.