primait/pyxis-components/3.3.1

NOTE: the latest version is 9.0.3

Prima.Pyxis.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.

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 itemsPerView.

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


...

Sets the new ViewMode by updating the State.

Retrieves the all ViewMode constructor.

Retrieves the partial ViewMode constructor.

Render

render : State -> Config -> Html Msg

Renders the component by receiving a State and a Config.