`` is a container component that wraps and formats a series of ``. As the base list component, it provides Material Design styling, but no behavior of its own. List items can be constructed in two ways depending the content they need to show: ### Simple lists If a list item needs to show a single line of textual information, the text can be inserted directly into the `` element. ```html Pepper Salt Paprika ``` ### Multi-line lists List items that have more than one line of text have to use the `matListItemTitle` directive to indicate their title text for accessibility purposes, in addition to the `matListItemLine` directive for each subsequent line of text. ```html Pepper Produced by a plant Salt Extracted from sea water Paprika Produced by dried and ground red peppers ``` To activate text wrapping, the `lines` input has to be set on the `` indicating the number of lines of text. The following directives can be used to style the content of a list item: | Directive | Description | |---------------------|----------------------------------------------------------------------------| | `matListItemTitle` | Indicates the title of the list item. Required for multi-line list items. | | `matListItemLine` | Wraps a line of text within a list item. | | `matListItemIcon` | Icon typically placed at the beginning of a list item. | | `matListItemAvatar` | Image typically placed at the beginning of a list item. | | `matListItemMeta` | Inserts content in the meta section at the end of a list item. | ### Navigation lists Use `mat-nav-list` tags for navigation lists (i.e. lists that have anchor tags). Simple navigation lists can use the `mat-list-item` attribute on anchor tag elements directly: ```html @for (link of list; track link) { {{ link }} } ``` For more complex navigation lists (e.g. with more than one target per item), wrap the anchor element in an ``. ```html @for (link of links; track link) { {{ link }} } ``` ### Action lists Use the `` element when each item in the list performs some _action_. Each item in an action list is a ` ``` ### Selection lists A selection list provides an interface for selecting values, where each list item is an option. The options within a selection-list should not contain further interactive controls, such as buttons and anchors. ### Multi-line lists For lists that require multiple lines per item, annotate each line with an `matListItemLine` attribute. Whichever heading tag is appropriate for your DOM hierarchy should be used (not necessarily `

` as shown in the example). ```html @for (message of messages; track message) {

{{message.from}}

{{message.subject}} -- {{message.content}}

}
@for (message of messages; track message) {

{{message.from}}

{{message.subject}}

{{message.content}}

}
``` ### Lists with icons To add an icon to your list item, use the `matListItemIcon` attribute. ```html @for (message of messages; track message) { folder

{{message.from}}

{{message.subject}} -- {{message.content}}

}
``` ### Lists with meta section icons To add a meta icon to your list item, use the `matListItemMeta` directive. This allows you to display an icon or any other content in the meta section of the list item. ```html @for (message of messages; track message) {
folder

{{message.from}}

{{message.subject}} -- {{message.content}}

}
``` ### Lists with avatars To include an avatar image, add an image tag with an `matListItemAvatar` attribute. ```html @for (message of messages; track message) { ...

{{message.from}}

{{message.subject}} -- {{message.content}}

}
``` ### Lists with multiple sections Subheaders can be added to a list by annotating a heading tag with an `matSubheader` attribute. To add a divider, use ``. ```html

Folders

@for (folder of folders; track folder) { folder

{{folder.name}}

{{folder.updated}}

}

Notes

@for (note of notes; track note) { note

{{note.name}}

{{note.updated}}

}
``` ### Accessibility Angular Material offers multiple varieties of list so that you can choose the type that best applies to your use-case. #### Navigation You should use `MatNavList` when every item in the list is an anchor that navigate to another URL. The root `` element sets `role="navigation"` and should contain only anchor elements with the `mat-list-item` attribute. You should not nest any interactive elements inside these anchors, including buttons and checkboxes. Always provide an accessible label for the `` element via `aria-label` or `aria-labelledby`. #### Selection You should use `MatSelectionList` and `MatListOption` for lists that allow the user to select one or more values. This list variant uses the `role="listbox"` interaction pattern, handling all associated keyboard input and focus management. You should not nest any interactive elements inside these options, including buttons and anchors. Always provide an accessible label for the `` element via `aria-label` or `aria-labelledby` that describes the selection being made. By default, `MatSelectionList` displays radio or checkmark indicators to identify selected items. While you can hide the radio indicator for single-selection via `hideSingleSelectionIndicator`, this makes the component less accessible by making it harder or impossible for users to visually identify selected items. #### Custom scenarios By default, the list assumes that it will be used in a purely decorative fashion and thus it sets no roles, ARIA attributes, or keyboard shortcuts. This is equivalent to having a sequence of `
` elements on the page. Any interactive content within the list should be given an appropriate accessibility treatment based on the specific workflow of your application. If the list is used to present a list of non-interactive content items, then the list element should be given `role="list"` and each list item should be given `role="listitem"`.