MobileStepperAPI
React MobileStepper 元件的 API 參考文件。瞭解此匯出模組的 props、CSS 和其他 API。
示範
Import
import MobileStepper from '@mui/material/MobileStepper';
// or
import { MobileStepper } from '@mui/material';
閱讀這份關於最小化 bundle 大小的指南,以瞭解差異。
Paper 元件的 Props 也可使用。
名稱 | 類型 | 預設 | 描述 |
---|---|---|---|
steps* | integer | - | 總步數。 |
activeStep | integer | 0 | 設定活動步驟(從零開始的索引)。定義當 variant 為 'dots' 時,哪個點會被強調顯示。 |
backButton | node | - | 後退按鈕元素。例如,它可以是 |
classes | object | - | 覆寫或擴充應用於元件的樣式。 請參閱下方CSS 類別 API 以瞭解更多詳細資訊。 |
LinearProgressProps | object | - | 應用於 |
nextButton | node | - | 下一個按鈕元素。例如,它可以是 |
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 內部的元件。 |
sx | Array<func | object | bool> | func | object | - | 系統 prop,允許定義系統覆寫以及其他 CSS 樣式。 請參閱 `sx` 頁面 以瞭解更多詳細資訊。 |
variant | 'dots' | 'progress' | 'text' | 'dots' | 要使用的 variant。 |
此元件無法持有 ref。
繼承
雖然上方未明確記載,但 Paper 元件的 props 也可在 MobileStepper 中使用。您可以利用此優勢來鎖定巢狀元件。
主題預設 props
您可以使用 MuiMobileStepper
透過主題變更此元件的預設 props。
Slot 名稱 | 類別名稱 | 預設元件 | 描述 |
---|---|---|---|
root | .MuiMobileStepper-root | Paper | 呈現 root slot 的元件。 |
progress | .MuiMobileStepper-progress | LinearProgress | 呈現 progress slot 的元件。 |
dots | .MuiMobileStepper-dots | 'div' | 呈現 dots slot 的元件。 |
dot | .MuiMobileStepper-dot | 'div' | 呈現 dot slot 的元件。 |
這些類別名稱對於使用 CSS 設定樣式很有用。它們在觸發特定狀態時會應用於元件的 slots。
類別名稱 | 規則名稱 | 描述 |
---|---|---|
.MuiMobileStepper-dotActive | dotActive | 如果 variant="dots" 且這是活動步驟,則應用於點的樣式。 |
.MuiMobileStepper-positionBottom | positionBottom | 如果 position="bottom" ,則應用於 root 元素的樣式。 |
.MuiMobileStepper-positionStatic | positionStatic | 如果 position="static" ,則應用於 root 元素的樣式。 |
.MuiMobileStepper-positionTop | positionTop | 如果 position="top" ,則應用於 root 元素的樣式。 |
您可以使用以下其中一種客製化選項來覆寫元件的樣式
- 使用全域類別名稱。
- 在自訂主題中使用規則名稱作為元件
styleOverrides
屬性的一部分。
原始碼
如果您在本頁中找不到資訊,請考慮查看元件的實作以取得更多詳細資訊。