Search
MaterialComponentsDocs
Components overviewApp barBadgeButtonsButton groupButtonExtended FABFAB menuFABIcon buttonSplit buttonCardCarouselCheckboxChipsDate & time pickersDate pickerTime pickerDialogDividerListLoading & progressLoading indicatorProgressMenuNavigationNavigation barNavigation drawerNavigation railRadio buttonsSearchSelectSheetsBottom sheetSide sheetSliderSnackbarSwitchTabsText fieldToolbarTooltip

List

Explore Material list anatomy. Configure text lines, media, supporting actions, and selection.

Morning walkRead a chapterTry a new recipe
FactoryWeb ComponentsReactVueSvelteSolidJS
PublishedUpdated

A list is a continuous, vertical index of text and images: a headline per row, with an overline, supporting text, and leading and trailing content such as an icon, an avatar or a time. Rows are one, two or three lines tall, and can be selected, one at a time or several.

Usage

Each item has an id and a headline. By default a row is a button that selects it, and choosing another row moves the selection.

Vanilla
import { createList } from 'material';

const list = createList({
  ariaLabel: 'Ideas for today',
  items: [
    { id: 'walk', headline: 'Morning walk' },
    { id: 'read', headline: 'Read a chapter' },
    { id: 'cook', headline: 'Try a new recipe' },
  ],
});
document.body.append(list.element);
Web Components
<m-list aria-label="Ideas for today">
  <m-list-item value="walk">Morning walk</m-list-item>
  <m-list-item value="read">Read a chapter</m-list-item>
  <m-list-item value="cook">Try a new recipe</m-list-item>
</m-list>
React
import { List, ListItem } from 'material/react';

export function Example() {
  return (
    <List ariaLabel="Ideas for today">
      <ListItem value="walk">Morning walk</ListItem>
      <ListItem value="read">Read a chapter</ListItem>
      <ListItem value="cook">Try a new recipe</ListItem>
    </List>
  );
}
Vue
<script setup lang="ts">
import { MList, MListItem } from 'material/vue';
</script>

<template>
  <MList aria-label="Ideas for today">
    <MListItem value="walk">Morning walk</MListItem>
    <MListItem value="read">Read a chapter</MListItem>
    <MListItem value="cook">Try a new recipe</MListItem>
  </MList>
</template>
Svelte
<script lang="ts">
  import { List, ListItem } from 'material/svelte';
</script>

<List ariaLabel="Ideas for today">
  <ListItem value="walk">Morning walk</ListItem>
  <ListItem value="read">Read a chapter</ListItem>
  <ListItem value="cook">Try a new recipe</ListItem>
</List>
SolidJS
import { List, ListItem } from 'material/solid';

export function Example() {
  return (
    <List ariaLabel="Ideas for today">
      <ListItem value="walk">Morning walk</ListItem>
      <ListItem value="read">Read a chapter</ListItem>
      <ListItem value="cook">Try a new recipe</ListItem>
    </List>
  );
}

Examples

Anatomy

supportingText and overline make a row two or three lines tall; lines sets it. leading and trailing are { type, content }: an icon, avatar, image or video leading, and an icon or text trailing. { kind: 'subheader' } titles a group and { kind: 'divider' } separates one, inset to line up with the text. trackSelection: false makes the rows display only.

Vanilla
import { createList } from 'material';

const list = createList({
  ariaLabel: 'Places',
  trackSelection: false,
  items: [
    { kind: 'subheader', headline: 'Places to explore' },
    {
      id: 'trail',
      headline: 'Mountain trail',
      supportingText: '5 km loop',
      leading: { type: 'icon', content: locationIcon },
      trailing: { type: 'text', content: '40 min' },
    },
    { kind: 'divider', inset: true },
    {
      id: 'garden',
      headline: 'Botanical garden',
      supportingText: 'Open until 6 pm',
      leading: { type: 'icon', content: locationIcon },
      trailing: { type: 'text', content: '15 min' },
    },
  ],
});
document.body.append(list.element);
Web Components
<m-list aria-label="Places" selection="none">
  <m-list-item kind="subheader">Places to explore</m-list-item>
  <m-list-item value="trail" supporting-text="5 km loop" trailing-text="40 min">Mountain trail</m-list-item>
  <m-list-item kind="divider" inset></m-list-item>
  <m-list-item value="garden" supporting-text="Open until 6 pm" trailing-text="15 min">Botanical garden</m-list-item>
</m-list>

<script type="module">
  const list = document.querySelector('m-list');
  list.querySelector('m-list-item[value="trail"]').setAttribute('leading-icon', locationIcon);
  list.querySelector('m-list-item[value="garden"]').setAttribute('leading-icon', locationIcon);
</script>
React
import { List, ListItem } from 'material/react';
import { locationIcon } from './app';

export function Example() {
  return (
    <List ariaLabel="Places" selection="none">
      <ListItem kind="subheader">Places to explore</ListItem>
      <ListItem value="trail" supportingText="5 km loop" leadingIcon={locationIcon} trailingText="40 min">Mountain trail</ListItem>
      <ListItem kind="divider" inset />
      <ListItem value="garden" supportingText="Open until 6 pm" leadingIcon={locationIcon} trailingText="15 min">Botanical garden</ListItem>
    </List>
  );
}
Vue
<script setup lang="ts">
import { MList, MListItem } from 'material/vue';
import { locationIcon } from './app';
</script>

<template>
  <MList aria-label="Places" selection="none">
    <MListItem kind="subheader">Places to explore</MListItem>
    <MListItem value="trail" supporting-text="5 km loop" :leading-icon="locationIcon" trailing-text="40 min">Mountain trail</MListItem>
    <MListItem kind="divider" inset />
    <MListItem value="garden" supporting-text="Open until 6 pm" :leading-icon="locationIcon" trailing-text="15 min">Botanical garden</MListItem>
  </MList>
</template>
Svelte
<script lang="ts">
  import { List, ListItem } from 'material/svelte';
  import { locationIcon } from './app';
</script>

<List ariaLabel="Places" selection="none">
  <ListItem kind="subheader">Places to explore</ListItem>
  <ListItem value="trail" supportingText="5 km loop" leadingIcon={locationIcon} trailingText="40 min">Mountain trail</ListItem>
  <ListItem kind="divider" inset />
  <ListItem value="garden" supportingText="Open until 6 pm" leadingIcon={locationIcon} trailingText="15 min">Botanical garden</ListItem>
</List>
SolidJS
import { List, ListItem } from 'material/solid';
import { locationIcon } from './app';

export function Example() {
  return (
    <List ariaLabel="Places" selection="none">
      <ListItem kind="subheader">Places to explore</ListItem>
      <ListItem value="trail" supportingText="5 km loop" leadingIcon={locationIcon} trailingText="40 min">Mountain trail</ListItem>
      <ListItem kind="divider" inset />
      <ListItem value="garden" supportingText="Open until 6 pm" leadingIcon={locationIcon} trailingText="15 min">Botanical garden</ListItem>
    </List>
  );
}

Several selected

multiSelect lets rows be selected together, and initialSelection (or an item's selected) sets the rows that start selected. A disabled row cannot be selected or focused.

Vanilla
import { createList } from 'material';

const list = createList({
  ariaLabel: 'Countries',
  multiSelect: true,
  initialSelection: ['fr', 'jp'],
  items: [
    { id: 'fr', headline: 'France' },
    { id: 'de', headline: 'Germany', disabled: true },
    { id: 'jp', headline: 'Japan' },
  ],
});
document.body.append(list.element);
Web Components
<m-list aria-label="Countries" selection="multiple">
  <m-list-item value="fr" selected>France</m-list-item>
  <m-list-item value="de" disabled>Germany</m-list-item>
  <m-list-item value="jp" selected>Japan</m-list-item>
</m-list>
React
import { List, ListItem } from 'material/react';

export function Example() {
  return (
    <List ariaLabel="Countries" selection="multiple">
      <ListItem value="fr" selected>France</ListItem>
      <ListItem value="de" disabled>Germany</ListItem>
      <ListItem value="jp" selected>Japan</ListItem>
    </List>
  );
}
Vue
<script setup lang="ts">
import { MList, MListItem } from 'material/vue';
</script>

<template>
  <MList aria-label="Countries" selection="multiple">
    <MListItem value="fr" selected>France</MListItem>
    <MListItem value="de" disabled>Germany</MListItem>
    <MListItem value="jp" selected>Japan</MListItem>
  </MList>
</template>
Svelte
<script lang="ts">
  import { List, ListItem } from 'material/svelte';
</script>

<List ariaLabel="Countries" selection="multiple">
  <ListItem value="fr" selected>France</ListItem>
  <ListItem value="de" disabled>Germany</ListItem>
  <ListItem value="jp" selected>Japan</ListItem>
</List>
SolidJS
import { List, ListItem } from 'material/solid';

export function Example() {
  return (
    <List ariaLabel="Countries" selection="multiple">
      <ListItem value="fr" selected>France</ListItem>
      <ListItem value="de" disabled>Germany</ListItem>
      <ListItem value="jp" selected>Japan</ListItem>
    </List>
  );
}

A choice emits select with { item, value, element, action, originalEvent, component, preventDefault, defaultPrevented } before the selection moves; preventDefault() leaves it where it was. Choosing the selected row again deselects it. The web component dispatches activate with { value }, then change with { value, values } when the selection moved. A trailing control or custom slot holds the app's own control; a component instance — anything with an element, such as createSwitch({}) — contributes its element. A control with no accessible name of its own takes the row's headline as its name and the supporting text as its description; a name the app gave always wins. With trackSelection, a checkable control is the row's action too: a click on the row reaches it, and the row's selected state follows the control's. A non-checkable trailing control stays independent, and a click on it does not select the row. A trailing control is sized by its content; a control that fills its container, such as a slider, is not a list-row control and goes outside the row. renderItem(item, index) renders a row the app's way. The list renders every item; for long or remote data, use vlist.

Single-select listbox (withSingleSelectListbox)

For a list where the user picks one option with the WAI-ARIA single-select listbox pattern (rather than action rows or multi-select checkboxes), wrap a trackSelection: true, multiSelect: false list with withSingleSelectListbox from material/components/list:

import { createList, withSingleSelectListbox } from 'material/components/list';

const list = withSingleSelectListbox(
  createList({
    ariaLabel: 'Billing cycle',
    trackSelection: true,
    multiSelect: false,
    initialSelection: ['annual'],
    items: [
      { id: 'monthly', headline: 'Monthly', supportingText: '$12 / month' },
      { id: 'annual', headline: 'Annual', supportingText: '$10 / month, billed yearly' },
    ],
  }),
  { indicator: 'leading' }, // 'leading' (default) | 'trailing' — places an inert radio indicator
);
  • Accessibility (role="listbox" / role="option"): Sets role="listbox" on the list, role="option" with aria-selected="true" | "false" on each selectable row, and a single roving tabindex="0" stop on the selected (or first enabled) option.
  • Manual activation: ArrowDown, ArrowRight, ArrowUp, ArrowLeft, Home, End, and printable-character typeahead move focus across enabled options and update the roving tabindex="0" while focus is inside the listbox (on focusout, tabindex="0" syncs back to the selected option); Space, Enter, or a pointer click activates and selects the option (setting aria-selected="true" and firing select).
  • Constraints: Refuses multiSelect: true, rows with interactive secondary actions, and link rows (href). Pages that do not import withSingleSelectListbox pay 0 B.

For a lean standalone popup rather than a list in the page, the opt-in material/components/listbox entry (with material/styles/listbox) provides a synchronous single-selection popup following the APG select-only combobox pattern: flat text options, separate active and committed state, keyboard and typeahead interaction, disabled options and top-layer placement. Import is SSR-safe; construction is client-only.

API

Options

items

The rows, subheaders and dividers

TypeListItem[]
Default[]
renderItem

Renders a row's content

Type(item, index) => HTMLElement
Defaultthe anatomy
trackSelection

Rows are buttons that select; false, display only

Typeboolean
Defaulttrue
multiSelect

Several rows selected at once

Typeboolean
Defaultfalse
initialSelection

The ids selected at creation

Type(string | number)[]
Defaultundefined
ariaLabel

The list's accessible name

Typestring
Defaultundefined
animate

Whether scrollToItem() and scrollToIndex() scroll smoothly by default

Typeboolean
Defaultfalse
class

Additional CSS classes

Typestring
Defaultundefined
prefix

Prefix for CSS class names

Typestring
Default'mtrl'
componentName

Component name used in class generation

Typestring
Default'list'

Items

kind

A row by default

Type'item' | 'subheader' | 'divider'
id

The row's id; its index without one

Typestring | number
headline

The row's text; text, title or name stand in for it

Typestring
overline / supportingText

The line above and the lines below the headline

Typestring
lines

The row's height; inferred from the text without it

Type1 | 2 | 3
leading

{ type: 'icon' | 'avatar' | 'image' | 'video' | 'text' | 'control' | 'custom', content }. A component instance — anything with an element, such as createSwitch({}) — contributes its element

TypeListSlot
trailing

The same, at the end. A control with no accessible name of its own takes the row's headline as its name and the supporting text as its description; a name the app gave always wins. With trackSelection, a checkable control is the row's action too: a click on the row reaches it, and the row's selected state follows the control's

TypeListSlot
selected / disabled

Selected at creation; not selectable

Typeboolean
inset

A divider lined up with the text

Typeboolean

Methods

getSelectedItems() / getSelectedItemIds()

The selection

ReturnsListItem[] / string[]
isItemSelected(id)

Whether a row is selected

Returnsboolean
selectItem(id) / deselectItem(id)

Adds a row to the selection, or removes it

ReturnsListComponent
setSelection(ids) / clearSelection()

Replaces or clears the selection

ReturnsListComponent
refresh()

Renders the items again, from the array the list holds

ReturnsPromise<ListComponent>
getAllItems() / getVisibleItems()

The items, all of them in both cases

ReturnsListItem[]
scrollToItem(id, position?, animate?)

Scrolls a row into view: 'start', 'center' or 'end'

ReturnsListComponent
scrollToIndex(index, position?, animate?)

The same, by index

ReturnsPromise<ListComponent>
isLoading() / hasNextPage()

Always false

Returnsboolean
on(event, handler) / off(event, handler)

Events

ReturnsListComponent
destroy()

Removes the list and its listeners

Returnsvoid

Events

select

A row was chosen, before the selection moves

Payload{ item, value, element, action, originalEvent, component, preventDefault, defaultPrevented }
load

The items were rendered, at creation and on refresh()

Payload{ items, loading, hasNext, hasPrev, component }
scroll

The list scrolled

Payload{ event, element, originalEvent }

element is always the row; action is the row's primary button, the node that carried the activation.

Styling

A selected row has the secondary-container color and 16dp corners.

.mtrl-list { }
.mtrl-list__content, .mtrl-list__subheader, .mtrl-list__divider, .mtrl-list__divider--inset, .mtrl-list__empty { }
.mtrl-list__item, .mtrl-list__item--two-line, .mtrl-list__item--three-line { }
.mtrl-list__item--selected, .mtrl-list__item--disabled, .mtrl-list__action { }
.mtrl-list__text, .mtrl-list__overline, .mtrl-list__headline, .mtrl-list__supporting { }
.mtrl-list__leading, .mtrl-list__leading--icon, .mtrl-list__leading--avatar, .mtrl-list__leading--image, .mtrl-list__leading--video { }
.mtrl-list__trailing, .mtrl-list__trailing--icon, .mtrl-list__trailing--text { }

Measurements

From Compose's ListItem and ListTokens:

Attribute Value
Row 56dp one line, 72dp two, 88dp three; 16dp between its parts
Padding 8dp top and bottom (12dp for three lines), 16dp at the sides
Text Headline Body Large on-surface; overline Label Small and supporting text Body Medium, on-surface-variant
Leading Icon 24dp; avatar 40dp; image 56dp; video 100 × 56dp (114 × 64dp in three lines)
Trailing text Label Small
Subheader Label Large, on-surface-variant
Divider 1dp outline-variant; inset 72dp from the start and 16dp from the end
Focus A 2dp secondary ring inside the row