GridLegacyAPI
React GridLegacy 组件的 API 参考文档。了解此导出模块的 props、CSS 和其他 API。
演示
导入
import GridLegacy from '@mui/material/GridLegacy';
// or
import { GridLegacy } from '@mui/material';
要了解差异,请阅读关于最小化捆绑包大小的指南。
原生组件的 Props 也可用。
名称 | 类型 | 默认值 | 描述 |
---|---|---|---|
children | node | - | 组件的内容。 |
classes | object | - | 覆盖或扩展应用于组件的样式。 有关更多详细信息,请参阅下方的 CSS 类 API。 |
columns | Array<number> | number | object | 12 | 列数。 |
columnSpacing | Array<number | string> | number | object | string | - | 定义 |
component | elementType | - | 用于根节点的组件。可以是用于 HTML 元素的字符串或组件。 |
container | bool | false | 如果为 |
direction | 'column-reverse' | 'column' | 'row-reverse' | 'row' | Array<'column-reverse' | 'column' | 'row-reverse' | 'row'> | object | 'row' | 定义 |
item | bool | false | 如果为 |
lg | 'auto' | number | bool | false | 如果是一个数字,则设置网格项使用的列数。它不能大于容器的总列数(默认为 12)。如果为 'auto',则网格项的宽度与其内容匹配。如果为 false,则忽略该 prop。如果为 true,则网格项的宽度会增长以使用网格容器中的可用空间。该值应用于 |
md | 'auto' | number | bool | false | 如果是一个数字,则设置网格项使用的列数。它不能大于容器的总列数(默认为 12)。如果为 'auto',则网格项的宽度与其内容匹配。如果为 false,则忽略该 prop。如果为 true,则网格项的宽度会增长以使用网格容器中的可用空间。该值应用于 |
rowSpacing | Array<number | string> | number | object | string | - | 定义 |
sm | 'auto' | number | bool | false | 如果是一个数字,则设置网格项使用的列数。它不能大于容器的总列数(默认为 12)。如果为 'auto',则网格项的宽度与其内容匹配。如果为 false,则忽略该 prop。如果为 true,则网格项的宽度会增长以使用网格容器中的可用空间。该值应用于 |
spacing | Array<number | string> | number | object | string | 0 | 定义 |
sx | Array<func | object | bool> | func | object | - | 系统 prop,允许定义系统覆盖以及其他 CSS 样式。 有关更多详细信息,请参阅 `sx` 页面。 |
wrap | 'nowrap' | 'wrap-reverse' | 'wrap' | 'wrap' | 定义 |
xl | 'auto' | number | bool | false | 如果是一个数字,则设置网格项使用的列数。它不能大于容器的总列数(默认为 12)。如果为 'auto',则网格项的宽度与其内容匹配。如果为 false,则忽略该 prop。如果为 true,则网格项的宽度会增长以使用网格容器中的可用空间。该值应用于 |
xs | 'auto' | number | bool | false | 如果是一个数字,则设置网格项使用的列数。它不能大于容器的总列数(默认为 12)。如果为 'auto',则网格项的宽度与其内容匹配。如果为 false,则忽略该 prop。如果为 true,则网格项的宽度会增长以使用网格容器中的可用空间。该值应用于所有屏幕尺寸,优先级最低。 |
zeroMinWidth | bool | false | 如果为 |
ref
被转发到根元素。主题默认 props
您可以使用 MuiGridLegacy
通过主题更改此组件的默认 props。
这些类名对于使用 CSS 设置样式很有用。当触发特定状态时,它们会应用于组件的插槽。
类名 | 规则名称 | 描述 |
---|---|---|
.MuiGridLegacy-container | container | 如果 container={true} ,则应用于根元素的样式。 |
.MuiGridLegacy-direction-xs-column | direction-xs-column | 如果 direction="column" ,则应用于根元素的样式。 |
.MuiGridLegacy-direction-xs-column-reverse | direction-xs-column-reverse | 如果 direction="column-reverse" ,则应用于根元素的样式。 |
.MuiGridLegacy-direction-xs-row-reverse | direction-xs-row-reverse | 如果 direction="row-reverse" ,则应用于根元素的样式。 |
.MuiGridLegacy-grid-xs-1 | grid-xs-1 | |
.MuiGridLegacy-grid-xs-10 | grid-xs-10 | |
.MuiGridLegacy-grid-xs-11 | grid-xs-11 | |
.MuiGridLegacy-grid-xs-12 | grid-xs-12 | |
.MuiGridLegacy-grid-xs-2 | grid-xs-2 | |
.MuiGridLegacy-grid-xs-3 | grid-xs-3 | |
.MuiGridLegacy-grid-xs-4 | grid-xs-4 | |
.MuiGridLegacy-grid-xs-5 | grid-xs-5 | |
.MuiGridLegacy-grid-xs-6 | grid-xs-6 | |
.MuiGridLegacy-grid-xs-7 | grid-xs-7 | |
.MuiGridLegacy-grid-xs-8 | grid-xs-8 | |
.MuiGridLegacy-grid-xs-9 | grid-xs-9 | |
.MuiGridLegacy-grid-xs-auto | grid-xs-auto | |
.MuiGridLegacy-grid-xs-true | grid-xs-true | |
.MuiGridLegacy-item | item | 如果 item={true} ,则应用于根元素的样式。 |
.MuiGridLegacy-root | root | 应用于根元素的样式。 |
.MuiGridLegacy-spacing-xs-1 | spacing-xs-1 | |
.MuiGridLegacy-spacing-xs-10 | spacing-xs-10 | |
.MuiGridLegacy-spacing-xs-2 | spacing-xs-2 | |
.MuiGridLegacy-spacing-xs-3 | spacing-xs-3 | |
.MuiGridLegacy-spacing-xs-4 | spacing-xs-4 | |
.MuiGridLegacy-spacing-xs-5 | spacing-xs-5 | |
.MuiGridLegacy-spacing-xs-6 | spacing-xs-6 | |
.MuiGridLegacy-spacing-xs-7 | spacing-xs-7 | |
.MuiGridLegacy-spacing-xs-8 | spacing-xs-8 | |
.MuiGridLegacy-spacing-xs-9 | spacing-xs-9 | |
.MuiGridLegacy-wrap-xs-nowrap | wrap-xs-nowrap | 如果 wrap="nowrap" ,则应用于根元素的样式。 |
.MuiGridLegacy-wrap-xs-wrap-reverse | wrap-xs-wrap-reverse | 如果 wrap="reverse" ,则应用于根元素的样式。 |
.MuiGridLegacy-zeroMinWidth | zeroMinWidth | 如果 zeroMinWidth={true} ,则应用于根元素的样式。 |
您可以使用以下自定义选项之一来覆盖组件的样式
- 使用全局类名。
- 使用规则名称作为自定义主题中组件的
styleOverrides
属性的一部分。
源代码
如果您在此页面中找不到所需的信息,请考虑查看组件的实现以获取更多详细信息。