NoRedInk/noredink-ui/12.13.0

NOTE: the latest version is 35.9.3

Nri.Ui.Switch.V1

view : List (Attribute msg) -> Bool -> Html msg

Render a switch. The boolean here indicates whether the switch is on or not.

type Attribute msg
onSwitch : (Bool -> msg) -> Attribute msg

Specify what happens when the switch is toggled.

Explicitly specify that you want this switch to be disabled. If you don't specify onSwitch, this is the default, but it's provided so you don't have to resort to filterMap or similar to build a clean list of attributes.

id : String -> Attribute msg

Set the HTML ID of the switch toggle. If you have only one on the page, you don't need to set this, but you should definitely set it if you have more than one.

label : Html msg -> Attribute msg

Add labeling text to the switch. This text should be descriptive and able to be displayed inline. It should not be interactive (if it were ergonomic to make this argument Html Never, we would!)