lenards/elm-ui-patternfly/1.5.1

NOTE: the latest version is 4.0.2

PF4.Radio

A component for presenting mutually exclusive choices

Definition

type Radio option msg

Opaque Radio element that can produce msg messages from a mutually exclusive choices of option

Constructor function

{ onChange : option -> msg
, selected : Maybe option
, label : String
, options :
List
{ value : option
, text : String
}
}
-> Radio option msg

Constructs a Radio from the arguments

Default configuration is to:

  • position of the radio button is to the left
  • the options are rendered "stacked", as a column

Argument Info:

  • label is for given context to all of the option

For example, if a user is choosing between some type of "resources", like the Volumes attached to a virtual machine, the label would be rendered above chooses related to Volumes.

Configuration functions

type alias OptionStatePalette =
{ idle : Color
, focused : Color
, selected : Color
}

A palette rendering the color of the radio button given the possible OptionState defined in elm-ui.

{ idle : Color
, focused : Color
, selected : Color
}
-> Radio option msg
-> Radio option msg

Render with a custom palette

asRow : Radio option msg -> Radio option msg

Configure to render options in a row, left-to-right

asColumn : Radio option msg -> Radio option msg

Configure to render options in a column, stacked

Extra Attributes functions

withOptionExtraAttributes : List (Attribute msg) -> Radio option msg -> Radio option msg

Provide a list of attributes to include on option label elements.

This will not impact the label rendered above the Radio button options.

Use withLabelAttributes to impact that element.

withLabelAttributes : List (Attribute msg) -> Radio option msg -> Radio option msg

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

If you're looking to add attributes to the Radio buttons options, use withOptionExtraAttributes.

Rendering element

toMarkup : Radio option msg -> Element msg

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