Html.Attributes
HTML & web
HTML attributes for server-rendered elements. String attributes (class, id, href, src, type_, ...), boolean attributes (disabled, checked, hidden, ...), and integer attributes (height, width, tabindex, ...). type_ / for_ avoid reserved words.
Types
Attribute
type Attribute msg = AttributeAn HTML attribute parameterized by a message type.
Examples
title : Attribute msg
title =
attribute "title" "Selm"Values
attribute
attribute : String -> String -> Attribute msgA raw name/value attribute.
Examples
attribute "data-id" "42"style
style : String -> String -> Attribute msgAn inline CSS style declaration.
Examples
style "color" "navy"map
map : (a -> b) -> Attribute a -> Attribute bRemap the message type of an attribute.
Examples
map Never (attribute "id" "main")classList
classList : List (String, Bool) -> Attribute msgBuild a class attribute from (name, enabled) pairs.
Examples
classList [ ("active", True), ("hidden", False) ]