List API
想要学习更多组件属性和 CSS API,可以查阅 React List 组件的 API 文档。
导入
import List from '@mui/material/List';
// 或
import { List } from '@mui/material';组件名称
在主题中,名称“MuiList”可用于提供默认属性(props),或者样式覆盖属性
原生(Native) 组件的属性也是可用的。
| 名称 | 类型 | 默认值 | 描述 |
|---|---|---|---|
| children | node | 组件的内容 | |
| classes | object | 覆盖或扩展应用于组件的样式。请参阅下文CSS API 了解更多详情。 | |
| component | elementType | The component used for the root node. Either a string to use a HTML element or a component. | |
| dense | bool | false | 如果 true,为键盘和鼠标输入设计的紧凑垂直填充将用于列表和列表项。 因为 dense 上下文,后代组件可以使用prop。 |
| disablePadding | bool | false | 如果 true, 垂直填充将从列表中删除。 |
| subheader | node | 子标题的内容,通常是 ListSubheader 。 | |
| sx | Array<func | object | bool> | func | object | The system prop that allows defining system overrides as well as additional CSS styles. See the `sx` page for more details. |
ref 则会被传递到根元素中。CSS
| 规则名称 | 全局类名 | 描述 |
|---|---|---|
| root | .MuiList-root | 应用于根元素的样式。 |
| padding | .MuiList-padding | Styles applied to 根元素 unless disablePadding={true}. |
| dense | .MuiList-dense | Styles applied to 根元素 if 密集度. |
| subheader | .MuiList-subheader | Styles applied to 根元素 if 提供一个subheader . |
您可以使用组件自定义选项对组件进行个性化:
- 具备 全局类名.
- 在自定义主体中,设定一个规则名称作为组件的
styleOverrides属性的一部分。