danielnarey/elm-semantic-dom/3.0.0

NOTE: this package is not compatible with Elm 0.19.1

Dom.Property

Set the value of an IDL attribute (a.k.a. "JavaScript property").

The functions in this module wrap VirtualDom.property.

See here for some background on when to use the functions in this module versus the functions in Dom.Attribute.

bool : Bool -> String -> Property msg

Set a property that takes a boolean value; the first argument gives the value and the second argument gives the key

[ "controls"
  |> Dom.Property.bool True
]
  |> Dom.Node.leaf "video"
string : String -> String -> Property msg

Set a property that takes a string value; the first argument gives the value and the second argument gives the key

"Hello World!"
  |> Dom.Element.textWrapper "p"
  |> Dom.Element.withAttributes
    [ "title"
      |> Dom.Property.string "Hello, again!"
    ]
int : Int -> String -> Property msg

Set a property that takes an integer value; the first argument gives the value and the second argument gives the key

[ "rows"
  |> Dom.Property.int 10
]
  |> Dom.Node.leaf "textarea"
float : Float -> String -> Property msg

Set a property that takes a floating point value; the first argument gives the value and the second argument gives the key

[ "type"
  |> Dom.Property.string "number"
, "min"
  |> Dom.Property.int 0
, "max"
  |> Dom.Property.int 1
, "step"
  |> Dom.Property.float 0.1
]
  |> Dom.Node.leaf "input"