跳转到内容

StepLabel API

想要学习更多组件属性和 CSS API,可以查阅 React StepLabel 组件的 API 文档。

导入

import StepLabel from '@mui/material/StepLabel';
// 或
import { StepLabel } from '@mui/material';
您可以通过 阅读本指南以最小化捆包大小 来了解这种差异。

组件名称

The name MuiStepLabel can be used when providing default props or style overrides in the theme.

属性

原生(Native) 组件的属性也是可用的。

名称类型默认值描述
childrennode
In most cases will simply be a string containing a title for the label.
classesobject
Override or extend the styles applied to the component. See CSS API below for more details.
componentsPropsobject{}
The props used for each slot inside.
errorboolfalse
If true, the step is marked as failed.
iconnode
Override the default label of the step icon.
optionalnode
The optional node to display.
StepIconComponentelementType
The component to render in place of the StepIcon.
StepIconPropsobject
Props applied to the StepIcon element.
sxArray<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.MuiStepLabel-rootStyles applied to the root element.
horizontal.MuiStepLabel-horizontalStyles applied to the root element if orientation="horizontal".
vertical.MuiStepLabel-verticalStyles applied to the root element if orientation="vertical".
label.MuiStepLabel-labelStyles applied to the label element that wraps `children`.
active.Mui-activeState class applied to the label element if active={true}.
completed.Mui-completedState class applied to the label element if completed={true}.
error.Mui-errorState class applied to the root and label elements if error={true}.
disabled.Mui-disabledState class applied to the root and label elements if disabled={true}.
iconContainer.MuiStepLabel-iconContainerStyles applied to the `icon` container element.
alternativeLabel.MuiStepLabel-alternativeLabelState class applied to the root and icon container and label if alternativeLabel={true}.
labelContainer.MuiStepLabel-labelContainerStyles applied to the container element which wraps label and `optional`.

您可以使用组件自定义选项对组件进行个性化:

演示项目