alexanderkiel/elm-mdc-alpha/1.4.0

Material.Options

Common properties for Material components.

Properties

class : String -> Property config msg

A single CSS class property.

id : String -> Property { config | id : Maybe String } msg

Sets the HTML id attribute of a component. In components like Checkbox or TextField the id is set on the native control HTML element.

onClick : msg -> Property config msg

Like HTML onClick but as property.

style : String -> String -> Property config msg

A CSS style as property.

noOp : Property config msg

A property which just does nothing.

This is useful in `Maybe.withDefault`.


Example:


    Maybe.map (onClick << Tell) maybeValue
        |> Maybe.withDefault Options.noOp

Modifier

when : Bool -> Property config msg -> Property config msg

Conditionally apply a property.

Example:


    onClick Msg |> when enabled

Working with HTML

styled : (List (Attribute msg) -> a) -> List (Property config msg) -> a

Style HTML elements using properties instead of HTML attributes.

Takes an HTML element constructor and a list of properties and returns that
element constructor with the corresponding HTML attributes applied.


Example:


    styled Html.h2 [ class "title" ]