lenards/elm-ui-patternfly/2.1.0

NOTE: the latest version is 4.0.2

PF6.Select

PF6 Select component

Select components allow users to choose one or more values from a list.

See: https://www.patternfly.org/components/menus/select

Definition

type Select msg

Opaque Select type

type SelectOption msg

A selectable option

Constructor

{ selected : Maybe String
, isOpen : Bool
, onToggle : Bool -> msg
, onSelect : String -> msg
, options : List (SelectOption msg)
}
-> Select msg

Construct a Select

select
    { selected = model.selectedColor
    , isOpen = model.selectOpen
    , onToggle = SelectToggled
    , onSelect = ColorSelected
    , options = [ option "red" "Red", option "blue" "Blue" ]
    }

Option constructors

option : String -> String -> SelectOption msg

Create a single option

optionGroup : String -> List (SelectOption msg) -> SelectOption msg

Create a group of options with a header label

Content modifiers

withPlaceholder : String -> Select msg -> Select msg

Set placeholder text (shown when nothing selected)

withLabel : String -> Select msg -> Select msg

Set a visible label above the select

withHelperText : String -> Select msg -> Select msg

Set helper text below the select

State modifiers

Disable the select

withDanger : Select msg -> Select msg

Danger/error validation state

Success validation state

Warning validation state

Rendering

toMarkup : Select msg -> Element msg

Render the Select as an Element msg