primait/pyxis-components/1.0.0

NOTE: the latest version is 9.0.3

Prima.Pyxis.ListChooser.ListChooser

Creates a List of ChooserItems component.

#Configuration

type Config

Represents the configuration of the component.

type State

Represents the component State.

type Msg

Represents an internal Msg for the component.

Represents a single item which can be selected via ListChooser's api.

#Configuration Helpers

config : Int -> String -> String -> Config

Creates the configuration of the ListChooser. ...

myConfig : ListChooser.Config
myConfig =
    let
        itemsPerView =
            5


        viewAllLabel =
            "Show all"


        viewPartialLabel =
            "Show first " ++ (String.fromInt itemsPerView) ++ " elements"
    in
    ListChooser.config itemsPerView viewAllLabel viewPartialLabel
...
init : ViewMode -> List ChooserItem -> ( State, Cmd Msg )

Creates the first instance of a ListChooser.

update : Msg -> State -> ( State, Cmd Msg )

Updates the State of the component. Used by the parent application to dispatch messages to this component.

#Helpers

createItem : Slug -> String -> 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


...
viewMode : ViewMode -> State -> State

Sets the new ViewMode by updating the State.

viewModeAll : ViewMode

Retrieves the all ViewMode constructor.

viewModePartial : ViewMode

Retrieves the partial ViewMode constructor.

#Render

render : State -> Config -> Html Msg

Renders the component by receiving a State and a Config.