Represent the configuration of the component.
Represent the component State.
Represents the messages dispatched by the ListChooser Component
Represent a single item which can be selected via ListChooser's API.
Defines the mode in which the list must be shown. It's possible to choose
between the full list of items (viewModeAll
) or a limited set of items (viewModePartial).
In this case the number of items to be shown is expressed via shownItems
.
config : Basics.Int -> String -> String -> Config
Create the configuration of the ListChooser.
...
myConfig : ListChooser.Config
myConfig =
let
shownItems =
5
viewAllLabel =
"Show all"
viewPartialLabel =
"Show first " ++ (String.fromInt shownItems) ++ " elements"
in
ListChooser.config shownItems viewAllLabel viewPartialLabel
...
init : ViewMode -> State
Creates the State record of a ListChooser.
update : Msg -> Config -> State -> State
Updates the state of the component when a Msg is received.
createItem : String -> String -> Basics.Bool -> ChooserItem
Creates a representation of a ChooserItem.
...
myItem : ListChooser.ChooserItem
myItem =
let
slug =
"my_item_slug"
content =
"Lorem ipsum dolor sit amet."
isSelected =
False
in
ListChooser.createItem (slug, content, isSelected)
...
render : State -> Config -> Html Msg
Renders the component by receiving a State and a Config.
withId : String -> Config -> Config
Adds an id
Html.Attribute to the ListChooser
.
withAttribute : Html.Attribute Msg -> Config -> Config
Adds a generic Html.Attribute
to the ListChooser
.
withItems : List ChooserItem -> State -> State
Adds items to the ListChooser instance State record.
withItemClass : String -> Config -> Config
Adds a class for every item into the Config
.
withMultipleSelection : Basics.Bool -> Config -> Config
Adds an id
Html.Attribute to the ListChooser
.
withSelectedItemClass : String -> Config -> Config
Adds a class for the selected items to the Config
.
withWrapperClass : String -> Config -> Config
Adds a class for the wrapper to the Config
.