# Lists **This documentation is fully rendered on the [Material Web catalog](https://material-web.dev/components/list/)** [Lists](https://m3.material.io/components/lists) are continuous, vertical indexes of text and images CImage of a mobile phone screen with a Recipies page and a list recipies in a material list. The first item is Fresh baked breads with an image of someone holding bread on the left and a horizontal three dot menu on the right. Then Tacos with an image of tacos and the same three dot menu * [Design article](https://m3.material.io/components/lists) * [API Documentation](#api) * [Source code](https://github.com/material-components/material-web/tree/main/list) ## Usage `` is a container composed of ``s of different types. ![Three items in a list. The first item says Apple as its headline. The second one says Banana in its headline as well as Banana is a yellow fruit as its sub header. The third list item says Cucumber in its headline and Cucumbers are long green fruits that are just as long as this multi-line description as its sub header which is on two lines.](images/list/usage.webp) ```html Fruits Apple Banana
Cucumber
Cucumbers are long green fruits that are just as long as this multi-line description
Shop for Kiwis
This will link you out in a new tab
open_in_new
``` ## Icon Items Icons can be slotted into list-items' `start` or `end` slot. ![A list with three items and dividers separating each item. The first item has the Lit logo and the text Lit. The second item has the Polymer logo and the text Polymer. The third item has the Angular logo and the text Angular.](images/list/usage-icon.webp) ```html Lit Polymer polymer Angular ``` ## Image Items Images should be slotted into list-items' `start` slot. ![A list with three image items. The first item is a square picture of a cat and the text Cat. The second is a picture of a kitten with the text Kitty Cat. The third item is a square image of an older kitten with the text Cate.](images/list/usage-image.webp) ```html Cat Kitty Cat Cate ``` ## Accessibility List can have its `role` and `tabindex` set via the `role` and `tabindex` attributes, and list items can have their `role` and `tabindex` set via the `type` and `tabindex` attributes respectively. > NOTE: List item has a limited set of `type`s that can be set on it. This is to > ensure that your list remains accessible with all other properties and options > presented to it. See the `ListItemType` TypeScript type exported by list item > for the current accepted values. By default these values are set to [`role="list"`](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/list_role) and `tabindex="-1"` for list, and [`role="listitem"`](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/listitem_role) and `tabindex="0"` for list items. ## Theming List and List Item supports [Material theming](https://github.com/material-components/material-web/blob/main/docs/theming/README.md) and can be customized in terms of color, typography, and shape. ### List & List Item Token | Default value ----------------------------------------------- | ------------- `--md-list-container-color` | `--md-sys-color-surface` `--md-list-item-container-shape` | `--md-sys-shape-corner-none` `--md-list-item-label-text-color` | `--md-sys-color-on-surface` `--md-list-item-supporting-text-color` | `--md-sys-color-on-surface-variant` `--md-list-item-trailing-supporting-text-color` | `--md-sys-color-on-surface-variant` `--md-list-item-label-text-font` | `--md-sys-typescale-label-large-font` `--md-list-item-supporting-text-font` | `--md-sys-typescale-body-medium-font` `--md-list-item-trailing-supporting-text-font` | `--md-sys-typescale-label-small-font` * [All List tokens](https://github.com/material-components/material-web/blob/main/tokens/_md-comp-list.scss) * [All List Item tokens](https://github.com/material-components/material-web/blob/main/tokens/_md-comp-list-item.scss) ### List & List Item Example ![Image of a list and list items of foods with their inventory stock number with a different theme applied](images/list/theming-list.webp) ```html
Apple
In stock
+100
Banana
In stock
56
Cucumber
Low stock
5
``` ### Icon List Item Token | Default value ------------------------------------ | ----------------------------------- `--md-list-item-leading-icon-color` | `--md-sys-color-on-surface-variant` `--md-list-item-trailing-icon-color` | `--md-sys-color-on-surface-variant` `--md-list-item-leading-icon-size` | `18px` `--md-list-item-trailing-icon-size` | `24px` * [All List Item tokens](https://github.com/material-components/material-web/blob/main/tokens/_md-comp-list-item.scss) ### Icon List Item Example ![Image of a list and icon list items of food names with a different theme applied](images/list/theming-icon.webp) ```html
Eggs
egg recommend
Ice Cream
icecream dangerous
Orange
nutrition recommend
``` ### Avatar List Item Token | Default value ------------------------------------------- | ------------- `--md-list-item-leading-avatar-label-color` | `--md-sys-color-on-primary-container` `--md-list-item-leading-avatar-label-font` | `--md-sys-typescale-title-medium-font` `--md-list-item-leading-avatar-color` | `--md-sys-color-primary-container` `--md-list-item-leading-avatar-size` | `40px` `--md-list-item-leading-avatar-shape` | `--md-sys-shape-corner-full` * [All List Item tokens](https://github.com/material-components/material-web/blob/main/tokens/_md-comp-list-item.scss) ### Image List Item Token | Default value ------------------------------------- | ------------- `--md-list-item-leading-image-height` | `56px` `--md-list-item-leading-image-width` | `56px` `--md-list-item-leading-image-shape` | `--md-sys-shape-corner-none` * [All List Item tokens](https://github.com/material-components/material-web/blob/main/tokens/_md-comp-list-item.scss) ### Image List Item Example ![Image of a list and image list items of cats with a different theme applied](images/list/theming-image.webp) ```html ``` ## API ### MdList <md-list> #### Properties | Property | Attribute | Type | Default | Description | | --- | --- | --- | --- | --- | | `items` | | `ListItem[]` | `undefined` | | #### Methods | Method | Parameters | Returns | Description | | --- | --- | --- | --- | | `activateNextItem` | _None_ | `ListItem` | Activates the next item in the list. If at the end of the list, the first item will be activated. | | `activatePreviousItem` | _None_ | `ListItem` | Activates the previous item in the list. If at the start of the list, the last item will be activated. | ### MdListItem <md-list-item> #### Properties | Property | Attribute | Type | Default | Description | | --- | --- | --- | --- | --- | | `disabled` | `disabled` | `boolean` | `false` | Disables the item and makes it non-selectable and non-interactive. | | `type` | `type` | `string` | `'text'` | Sets the behavior of the list item, defaults to "text". Change to "link" or "button" for interactive items. | | `href` | `href` | `string` | `''` | Sets the underlying `HTMLAnchorElement`'s `href` resource attribute. | | `target` | `target` | `string` | `''` | Sets the underlying `HTMLAnchorElement`'s `target` attribute when `href` is set. | #### Events | Event | Type | [Bubbles](https://developer.mozilla.org/en-US/docs/Web/API/Event/bubbles) | [Composed](https://developer.mozilla.org/en-US/docs/Web/API/Event/composed) | Description | | --- | --- | --- | --- | --- | | `request-activation` | `Event` | Yes | Yes | Requests the list to set `tabindex=0` on the item and focus it. |