alexanderkiel / elm-mdc-alpha / Material.Options

Common properties for Material components.

Properties

class : String -> Material.Internal.Options.Property config msg

A single CSS class property.

id : String -> Material.Internal.Options.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 -> Material.Internal.Options.Property config msg

Like HTML onClick but as property.

style : String -> String -> Material.Internal.Options.Property config msg

A CSS style as property.

noOp : Material.Internal.Options.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 : Basics.Bool -> Material.Internal.Options.Property config msg -> Material.Internal.Options.Property config msg

Conditionally apply a property.

Example:

    onClick Msg |> when enabled

Working with HTML

styled : (List (Html.Attribute msg) -> a) -> List (Material.Internal.Options.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" ]