StepLabelAPI
React StepLabel 组件的 API 参考文档。了解此导出的模块的属性、CSS 和其他 API。
演示
导入
import StepLabel from '@mui/material/StepLabel';
// or
import { StepLabel } from '@mui/material';
阅读关于最小化 bundle size 的指南,了解它们之间的区别。
原生组件的属性也可用。
名称 | 类型 | 默认值 | 描述 |
---|---|---|---|
children | node | - | 在大多数情况下,这只是一个包含标签标题的字符串。 |
classes | object | - | 覆盖或扩展应用于组件的样式。 有关更多详细信息,请参见下方的CSS 类 API。 |
componentsProps | { label?: object } | {} | 用于内部每个插槽的属性。 |
error | bool | false | 如果为 |
icon | node | - | 覆盖步骤图标的默认标签。 |
optional | node | - | 要显示的可选节点。 |
slotProps | { label?: func | object, root?: func | object, stepIcon?: func | object } | {} | 用于内部每个插槽的属性。 |
slots | { label?: elementType, root?: elementType, stepIcon?: elementType } | {} | 用于内部每个插槽的组件。 |
StepIconComponent | elementType | - | 用于渲染以代替 |
StepIconProps | object | - | 应用于 |
sx | Array<func | object | bool> | func | object | - | 允许定义系统覆盖以及其他 CSS 样式的系统属性。 有关更多详细信息,请参见`sx` 页面。 |
ref
被转发到根元素。主题默认属性
您可以使用 MuiStepLabel
通过主题更改此组件的默认属性。
插槽名称 | 类名 | 默认组件 | 描述 |
---|---|---|---|
root | .MuiStepLabel-root | span | 渲染根的组件。 |
label | .MuiStepLabel-label | span | 渲染标签的组件。 |
stepIcon | 用于渲染以代替 StepIcon 的组件。 |
这些类名对于使用 CSS 进行样式设置很有用。当触发特定状态时,它们将应用于组件的插槽。
类名 | 规则名称 | 描述 |
---|---|---|
.Mui-active | 如果 active={true} ,则应用于 label 元素的状态类。 | |
.Mui-completed | 如果 completed={true} ,则应用于 label 元素的状态类。 | |
.Mui-disabled | 如果 disabled={true} ,则应用于 root 和 label 元素的状态类。 | |
.Mui-error | 如果 error={true} ,则应用于 root 和 label 元素的状态类。 | |
.MuiStepLabel-alternativeLabel | alternativeLabel | 如果 alternativeLabel={true} ,则应用于 root、icon 容器和 label 的状态类。 |
.MuiStepLabel-horizontal | horizontal | 如果 orientation="horizontal" ,则应用于 root 元素的样式。 |
.MuiStepLabel-iconContainer | iconContainer | 应用于 icon 容器元素的样式。 |
.MuiStepLabel-labelContainer | labelContainer | 应用于包装 label 和 optional 的容器元素的样式。 |
.MuiStepLabel-vertical | vertical | 如果 orientation="vertical" ,则应用于 root 元素的样式。 |
您可以使用以下自定义选项之一来覆盖组件的样式
- 使用全局类名。
- 在自定义主题中使用规则名称作为组件
styleOverrides
属性的一部分。
源代码
如果您在此页面中找不到所需的信息,请考虑查看组件的实现以获取更多详细信息。