lenards / elm-ui-patternfly / PF4.Checkbox

A component for presenting an option to select (either single item or multiple items); typically this is a choose to do an action or reflects an "on/off" or binary setting.

Definition


type Checkbox msg

Opaque Checkbox element that can produce msg messages for indicating a selection

Constructor function

checkbox : { checked : Basics.Bool, onCheck : Basics.Bool -> msg, label : String } -> Checkbox msg

Constructs a Checkbox from the arguments

Configuration functions


type alias Palette =
{ idle : Element.Color
, focused : Element.Color
, checked : Element.Color 
}

A palette rendering the color of the checkbox

withPalette : Palette -> Checkbox msg -> Checkbox msg

Render with a custom palette

withLabelAttributes : List (Element.Attribute msg) -> Checkbox msg -> Checkbox msg

Provide a list of attributes to include on the label element.

In Standalone mode, the attributes won't have any impact because there is no label.

Yes, that sure seems like an impossible state! I haven't quite grokked how I might disallow this. I realize that the Phantom Builder would be one way; but I'm not totally comfortable about that.

Perhaps it makes more sense for "Standalone" to be a wholly different type.

Rendering element

toMarkup : Checkbox msg -> Element msg

Given the custom type representation, renders as an Element msg.