Dropdown
Options
{ value : String
, text : String
, enabled : Basics.Bool
}
Item is the individual content of the dropdown.
value
is the item value or id
text
is the display text of the dropdown item.enabled
is a flag to indicate whether the item is enabled or disabled.{ items : List Item
, emptyItem : Maybe Item
, onChange : Maybe String -> msg
}
Options for the dropdown.
items
is content of the dropdown.emptyItem
is the item for when the nothing is selected. Set to Nothing
for no empty item.onChange
is the message for when the selected value in the dropdown is changed.defaultOptions : (Maybe String -> msg) -> Options msg
Default Options, will give you empty dropdown with no empty item
dropdown : Options msg -> List (Html.Attribute msg) -> Maybe String -> Html msg
Html element.
Put this in your view's Html content. Example:
type Msg = DropdownChanged String
Html.div []
[ Dropdown.dropdown
(Dropdown.defaultOptions DropdownChanged)
[ class "my-dropdown" ]
model.selectedDropdownValue
]