跳到主要内容跳到主要内容

MobileStepperAPI

React MobileStepper 组件的 API 参考文档。了解此导出模块的 props、CSS 和其他 API。

演示

导入

import MobileStepper from '@mui/material/MobileStepper';
// or
import { MobileStepper } from '@mui/material';

了解更多关于差异的信息,请阅读关于最小化 bundle size 的指南

Props

Paper 组件的 Props 也可用。

名称类型默认值描述
steps*integer-

总步数。

activeStepinteger0

设置活动步骤(从零开始的索引)。定义当 variant 为 'dots' 时哪个点被高亮显示。

backButtonnode-

后退按钮元素。例如,它可以是 ButtonIconButton

classesobject-

覆盖或扩展应用于组件的样式。

有关更多详细信息,请参阅下面的 CSS 类 API

LinearProgressPropsobject-

应用于 LinearProgress 元素的 Props。

nextButtonnode-

前进按钮元素。例如,它可以是 ButtonIconButton

position'bottom'
| 'static'
| 'top'
'bottom'

设置定位类型。

slotProps{ dot?: func
| object, dots?: func
| object, progress?: func
| object, root?: func
| object }
{}

用于内部每个 slot 的 props。

slots{ dot?: elementType, dots?: elementType, progress?: elementType, root?: elementType }{}

用于内部每个 slot 的组件。

sxArray<func
| object
| bool>
| func
| object
-

允许定义系统覆盖以及其他 CSS 样式的系统 prop。

有关更多详细信息,请参阅 `sx` 页面

variant'dots'
| 'progress'
| 'text'
'dots'

要使用的 variant。

该组件无法保存 ref。

继承

虽然上面没有明确文档说明,但 Paper 组件的 props 也可在 MobileStepper 中使用。您可以利用这一点来定位嵌套组件

主题默认 props

您可以使用 MuiMobileStepper 通过主题更改此组件的默认 props。

Slots

Slot 名称类名默认组件描述
root.MuiMobileStepper-rootPaper渲染 root slot 的组件。
progress.MuiMobileStepper-progressLinearProgress渲染 progress slot 的组件。
dots.MuiMobileStepper-dots'div'渲染 dots slot 的组件。
dot.MuiMobileStepper-dot'div'渲染 dot slot 的组件。

CSS 类

这些类名对于使用 CSS 进行样式设置很有用。当触发特定状态时,它们会应用于组件的 slots。

类名规则名称描述
.MuiMobileStepper-dotActivedotActive如果 variant="dots" 且这是活动步骤,则应用于点的样式。
.MuiMobileStepper-positionBottompositionBottom如果 position="bottom",则应用于 root 元素的样式。
.MuiMobileStepper-positionStaticpositionStatic如果 position="static",则应用于 root 元素的样式。
.MuiMobileStepper-positionToppositionTop如果 position="top",则应用于 root 元素的样式。

您可以使用以下自定义选项之一覆盖组件的样式

源代码

如果您在此页面中没有找到所需的信息,请考虑查看组件的实现以获取更多详细信息。