Lists are continuous, vertical indexes of text or images.
import Material.List
exposing
( list
, listConfig
, listItem
, listItemConfig
)
main =
list listConfig
[ listItem listItemConfig [ text "Line item" ]
, listItem listItemConfig [ text "Line item" ]
]Default configuration of a list
Configuration of a list
List item view function
Default configuration of a list item
Configuration of a list item
Lists may be two-line lists by settings the twoLine configuration field to
True. In that case, list items should wrap their contents inside
listItemText and their first line in listItemPrimaryText and their second
line in listItemSecondaryText.
list { listConfig | twoLine = True }
[ listItem listItemConfig
[ listItemText []
[ listItemPrimaryText []
[ text "First line" ]
, listItemSecondaryText []
[ text "Second line" ]
]
]
]List item's text for list items in a two-line list
First line of a two-line list item's text
Second line of a two-line list item's text
Lists may be non-interactive by setting the nonInteractive configuration
field to True.
list { listConfig | nonInteractive = True }
[ listItem listItemConfig [ text "List item" ] ]Lists may be styled more compact by setting the dense configuration field to
True.
list { listConfig | dense = True }
[ listItem listItemConfig [ text "List item" ] ]List item's graphics may be configured to appear larger by setting the
avatarList configuration field to True.
This is particularly useful when a list item's graphic includes an image rather than an icon.
list { listConfig | dense = True }
[ listItem listItemConfig
[ listItemGraphic [] [ Html.img [] [] ]
, text "List item"
]
]Multiple related lists, such as folders and files in a file hierarchy, may be
grouped using listGroup and labeled by listGroupSubheader.
listGroup []
[ listGroupSubheader [] [ text "Folders" ]
, list listConfig
[ listItem [] [ text "Folder" ]
, listItem [] [ text "Folder" ]
]
, listGroupSubheader [] [ text "Files" ]
, list listConfig
[ listItem [] [ text "File" ]
, listItem [] [ text "File" ]
]
]List group view function
List group subheader view function
Multiple lists within a group may be visually seperated by a list group divider.
listGroup []
[ list listConfig
[ listItem [] [ text "Folder" ]
, listItem [] [ text "Folder" ]
]
, listGroupDivider []
, list listConfig
[ listItem [] [ text "File" ]
, listItem [] [ text "File" ]
]
]List group divider view function
In addition to their text child, lists may optionally contain a starting tile referred to as graphic and/ or a last tile referred to as meta.
Common examples for graphics are icons and images, avatar images and selection controls such as checkboxes.
listItem listItemConf
[ listItemGraphic [] [ icon iconConf "star" ]
, text "List item"
]A list item's graphic tile
Common examples for metas are text, icons and images and selection controls.
listItem listItemConf
[ text "List item"
, listItemMeta [] [ icon iconConf "star" ]
]A list item's meta tile
List items may be disabled by setting their disabled configuration field to
True.
listItem { listItemConf | disabled = True }
[ text "List item" ]List items may be disabled by setting their selected configuration field to
True.
listItem { listItemConf | selected = True }
[ text "List item" ]List items may be disabled by setting their activated configuration field to
True.
listItem { listItemConf | activated = True }
[ text "List item" ]List items may be seperated by a divider. The divider may optionally be inset
so that it does not intersect the list item's graphic, or padded so that it
does not intersect the list item's meta.
list listConfig
[ listItem [] [ text "List item" ]
, listItemDivider listItemDividerConfig
, listItem [] [ text "List item" ]
]List item divider view function
Default configuration of a list item divider
Configuration of a list item divider
List view function