PaackEng/paack-ui/6.4.0

NOTE: the latest version is 7.23.0

UI.ListView.SummaryItem

SummaryItem represents a single item in a list that is usually selectable or searchable. This component is meant to be used with ListView.

import UI.ListView.SummaryItem as Summary


listItemView : AppConfig -> Bool -> Item -> Element Msg
listItemView appConfig isSelected item =
    Summary.summaryItem item.name item.subtitle
        |> Summary.withSelected isSelected
        |> Summary.withBadge (Badge.grayLight "badge")
        |> Summary.renderElement appConfig.renderConfig


listView : AppConfig -> Model -> ListView Item Msg
listView appConfig model =
    listItemView appConfig
        |> ListView.selectList Msg.Select Item.id
        |> ListView.withSearchField (searchField appConfig model)
        |> ListView.withActionBar (actionBar appConfig)
        |> ListView.withDomId "item-list"

Building

type SummaryItem msg

The SummaryItem msg type is used for describing the component for later rendering.

summaryItem : String -> String -> SummaryItem msg

Constructs a summary by receiving its title and caption.

Summary.summaryItem "Item title" "Item caption"

Options

withSelected : Bool -> SummaryItem msg -> SummaryItem msg

Indicates whether the summary is selected or not.

Summary.withSelected True
    someListView

Adds a badge to the right side of the summary.

Summary.withBadge someBadge
    someListView

Adds a checkbox to the left side of the summary.

Summary.withCheckbox someCheckbox
    someListView

Adds an icon to the right side of the summary.

Summary.withIcon (Icon.fix "Problem Solving")
    someListView

Adds an icon to the left side of the summary.

Summary.withBulletIcon (Icon.fixIssues "Problem Solving")
    someListView

Applies a tone to summary's background.

Summary.withBackgroundTone Palette.toneWarning
    someListView

Rendering

renderElement : RenderConfig -> SummaryItem msg -> Element msg

End of the builder's life. The result of this function is a ready-to-insert Elm UI's Element.