Select provides a single-option select menus.
This module concerns the select option. If you are looking for information about the container select, refer to Material.Select.
import Material.Select as Select
import Material.Select.Option as SelectOption
type Msg
= ValueChanged String
main =
Select.filled
(Select.config
|> Select.setLabel "Fruit"
|> Select.setValue (Just "")
|> Select.setOnChange ValueChanged
)
[ SelectOption.selectOption
(SelectOption.config
|> SelectOption.setValue (Just "")
)
[ text "" ]
, SelectOption.selectOption
(SelectOption.config
|> SelectOption.setValue (Just "Apple")
)
[ text "Apple" ]
]Default configuration of a select option
Specify a select option's label
Specify whether a select option is disabled
Disabled select options cannot be selected.
Specify additional attributes
Select option type
Select option constructor
To disable one select's option, set its setDisabled configuration option to
True.
SelectOption.selectOption
(SelectOption.config |> SelectOption.setDisabled True)
[ text "" ]This is particularly useful on the first emply option if you have a select that must be filled but is not initially filled.
Configuration of a select option