evancz/elm-svg/2.0.1

NOTE: this package moved to elm/svg

NOTE: this package is not compatible with Elm 0.19.1

Svg

SVG Nodes

type alias Svg =
Node

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!

type alias Attribute =
Property

Set attributes on your Svg.

node : String -> List Attribute -> List Svg -> Svg

Create any SVG node. To create a <rect> helper function, you would write:

rect : List Attribute -> List Svg -> Svg
rect attributes children =
    node "rect" attributes children

You should always be able to use the helper functions already defined in this library though!

text : String -> Svg

A simple text node, no tags at all.

Warning: not to be confused with text' which produces the SVG <text> tag!

HTML Embedding

svg : List Attribute -> List Svg -> Html

The root <svg> node for any SVG scene. This example shows a scene containing a rounded rectangle:

import Html
import Svg exposing (..)
import Svg.Attributes exposing (..)


roundRect : Html.Html
roundRect =
    svg
      [ width "120", height "120", viewBox "0 0 120 120" ]
      [ rect [ x "10", y "10", width "100", height "100", rx "15", ry "15" ] [] ]
foreignObject : List Attribute -> List Html -> Svg

Graphics elements

circle : List Attribute -> List Svg -> Svg
ellipse : List Attribute -> List Svg -> Svg
image : List Attribute -> List Svg -> Svg
line : List Attribute -> List Svg -> Svg
path : List Attribute -> List Svg -> Svg
polygon : List Attribute -> List Svg -> Svg
polyline : List Attribute -> List Svg -> Svg
rect : List Attribute -> List Svg -> Svg
use : List Attribute -> List Svg -> Svg

Animation elements

animate : List Attribute -> List Svg -> Svg
animateColor : List Attribute -> List Svg -> Svg
animateMotion : List Attribute -> List Svg -> Svg
animateTransform : List Attribute -> List Svg -> Svg
mpath : List Attribute -> List Svg -> Svg
set : List Attribute -> List Svg -> Svg

Descriptive elements

desc : List Attribute -> List Svg -> Svg
metadata : List Attribute -> List Svg -> Svg
title : List Attribute -> List Svg -> Svg

Containers

a : List Attribute -> List Svg -> Svg
defs : List Attribute -> List Svg -> Svg
g : List Attribute -> List Svg -> Svg
marker : List Attribute -> List Svg -> Svg
mask : List Attribute -> List Svg -> Svg
missingGlyph : List Attribute -> List Svg -> Svg
pattern : List Attribute -> List Svg -> Svg
switch : List Attribute -> List Svg -> Svg
symbol : List Attribute -> List Svg -> Svg

Text

altGlyph : List Attribute -> List Svg -> Svg
altGlyphDef : List Attribute -> List Svg -> Svg
altGlyphItem : List Attribute -> List Svg -> Svg
glyph : List Attribute -> List Svg -> Svg
glyphRef : List Attribute -> List Svg -> Svg
textPath : List Attribute -> List Svg -> Svg
text' : List Attribute -> List Svg -> Svg
tref : List Attribute -> List Svg -> Svg
tspan : List Attribute -> List Svg -> Svg

Fonts

font : List Attribute -> List Svg -> Svg
fontFace : List Attribute -> List Svg -> Svg
fontFaceFormat : List Attribute -> List Svg -> Svg
fontFaceName : List Attribute -> List Svg -> Svg
fontFaceSrc : List Attribute -> List Svg -> Svg
fontFaceUri : List Attribute -> List Svg -> Svg
hkern : List Attribute -> List Svg -> Svg
vkern : List Attribute -> List Svg -> Svg

Gradients

linearGradient : List Attribute -> List Svg -> Svg
radialGradient : List Attribute -> List Svg -> Svg
stop : List Attribute -> List Svg -> Svg

Filters

feBlend : List Attribute -> List Svg -> Svg
feColorMatrix : List Attribute -> List Svg -> Svg
feComponentTransfer : List Attribute -> List Svg -> Svg
feComposite : List Attribute -> List Svg -> Svg
feConvolveMatrix : List Attribute -> List Svg -> Svg
feDiffuseLighting : List Attribute -> List Svg -> Svg
feDisplacementMap : List Attribute -> List Svg -> Svg
feFlood : List Attribute -> List Svg -> Svg
feFuncA : List Attribute -> List Svg -> Svg
feFuncB : List Attribute -> List Svg -> Svg
feFuncG : List Attribute -> List Svg -> Svg
feFuncR : List Attribute -> List Svg -> Svg
feGaussianBlur : List Attribute -> List Svg -> Svg
feImage : List Attribute -> List Svg -> Svg
feMerge : List Attribute -> List Svg -> Svg
feMergeNode : List Attribute -> List Svg -> Svg
feMorphology : List Attribute -> List Svg -> Svg
feOffset : List Attribute -> List Svg -> Svg
feSpecularLighting : List Attribute -> List Svg -> Svg
feTile : List Attribute -> List Svg -> Svg
feTurbulence : List Attribute -> List Svg -> Svg

Light source elements

feDistantLight : List Attribute -> List Svg -> Svg
fePointLight : List Attribute -> List Svg -> Svg
feSpotLight : List Attribute -> List Svg -> Svg

Miscellaneous

clipPath : List Attribute -> List Svg -> Svg
colorProfile : List Attribute -> List Svg -> Svg
cursor : List Attribute -> List Svg -> Svg
filter : List Attribute -> List Svg -> Svg
script : List Attribute -> List Svg -> Svg
style : List Attribute -> List Svg -> Svg
view : List Attribute -> List Svg -> Svg