Provide helper functions to handle CSS modules in Elm without hacks
An opaque type representing transformed class name JSON object generated by CSS modules.
decode : Json.Decode.Decoder CssClass
Decode CSS transformed class name JSON object to CssClass
.
empty : CssClass
A CssClass
value which contains nothing.
This value can be used as a default value for failing to decode JSON object.
class : CssClass -> String -> Html.Attribute msg
An alternative function to Html.Attributes.class
.
This function actually sets a class attribute with value of transformed class name.
e.g., If provided following JSON object and it is decoded as cssClass : CssClass
by decode
function,
{
"title": "_title_xkpkl_5 _title_116zl_1",
"article": "_article_xkpkl_10",
}
CssClasses.class cssClass "title"
This is equivalent to
Html.Attributes.class "_title_xkpkl_5 _title_116zl_1"
classList : CssClass -> List ( String, Basics.Bool ) -> Html.Attribute msg
An alternative function to Html.Attributes.classList