Introduction
Lists are a continuous group of text or images. They are composed of items containing primary and supplemental actions, which are represented by icons and text.Basic Usage
Simple List
A simple list with text items.Nested List
Create nested lists using collapse and state management.List with Icons
Add icons to list items usingListItemIcon.
List with Avatars
UseListItemAvatar to add avatars to list items.
List with Secondary Action
Add secondary actions like checkboxes or buttons usingsecondaryAction prop.
List with Switch
Add switches to list items for toggle functionality.Dense Lists
Use thedense prop to reduce vertical padding.
Subheader
Add a subheader to organize list sections.Props
List Props
| Prop | Type | Default | Description |
|---|---|---|---|
children | node | - | The content of the component. |
classes | object | - | Override or extend the styles applied to the component. |
dense | boolean | false | If true, compact vertical padding designed for keyboard and mouse input is used. |
disablePadding | boolean | false | If true, vertical padding is removed from the list. |
subheader | node | - | The content of the subheader, normally ListSubheader. |
sx | SxProps<Theme> | - | The system prop for defining CSS overrides and additional styles. |
ListItem Props
| Prop | Type | Default | Description |
|---|---|---|---|
alignItems | 'flex-start' | 'center' | 'center' | Defines the align-items style property. |
children | node | - | The content of the component. |
classes | object | - | Override or extend the styles applied to the component. |
dense | boolean | false | If true, compact vertical padding designed for keyboard and mouse input is used. |
disableGutters | boolean | false | If true, the left and right padding is removed. |
disablePadding | boolean | false | If true, all padding is removed. |
divider | boolean | false | If true, a 1px light border is added to the bottom. |
secondaryAction | node | - | The element to display at the end of ListItem. |
sx | SxProps<Theme> | - | The system prop for defining CSS overrides and additional styles. |
CSS Classes
List Classes
.MuiList-root- Styles applied to the root element..MuiList-padding- Styles applied to the root element unlessdisablePadding={true}..MuiList-dense- Styles applied to the root element ifdense={true}..MuiList-subheader- Styles applied to the root element if asubheaderis provided.
ListItem Classes
.MuiListItem-root- Styles applied to the root element..MuiListItem-dense- Styles applied to the root element ifdense={true}..MuiListItem-alignItemsFlexStart- Styles applied ifalignItems="flex-start"..MuiListItem-divider- Styles applied to the root element ifdivider={true}..MuiListItem-gutters- Styles applied to the root element unlessdisableGutters={true}..MuiListItem-padding- Styles applied to the root element unlessdisablePadding={true}..MuiListItem-secondaryAction- Styles applied to the root element ifsecondaryActionis provided.
Accessibility
Navigation Lists
When using lists for navigation, usecomponent="nav" and role="navigation":
Interactive Lists
For interactive list items, useListItemButton instead of wrapping with other interactive elements:
Labeling
Provide clear labels for screen readers usingaria-label or aria-labelledby: