lenards/elm-ui-patternfly/1.5.0

NOTE: the latest version is 4.0.2

PF4.Switch

A component for toggling or switching values on or off

Definition

type Switch msg

Opaque Switch element that can produce msg messages

Constructor function

{ checked : Bool
, onText : String
, offText : String
, onChange : Bool -> msg
}
-> Switch msg

Constructs a Switch from the arguments

  • onText is the text that will be displayed when the switch is "on", or checked is true
  • offText is the text that will be displayed when the switch is "off", or checked is false

Configuration functions

Configures the position of the text to be on the left of the switch

The default position of the text is to the right of the switch.

{ onText : String
, offText : String
}
-> Switch msg
-> Switch msg

Configures the text display when the switch is "on" or "off"

State change functions

isChecked : Switch msg -> Bool

Return true is the element is checked, otherwise false

Set the checked value to true

Set the checked value to false

Given the internal checked state, set it to the opposite

Rendering element

toMarkup : Switch msg -> Element msg

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