跳到主要內容跳到主要內容

SpeedDialAPI

React SpeedDial 元件的 API 參考文件。了解此匯出模組的屬性、CSS 和其他 API。

示範

導入

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

閱讀這份關於最小化 bundle size 的指南,以了解差異。

屬性

原生元件的屬性也可用。

名稱類型預設描述
ariaLabel*string-

按鈕元素的 aria-label。也用於為 SpeedDial 元素及其子元素提供 id

childrennode-

當 SpeedDial 為 open 時要顯示的 SpeedDialActions。

classesobject-

覆寫或擴展應用於元件的樣式。

請參閱下方CSS 類別 API 以了解更多詳細資訊。

direction'down'
| 'left'
| 'right'
| 'up'
'up'

相對於浮動操作按鈕,動作開啟的方向。

FabPropsobject{}

應用於 Fab 元素的屬性。

hiddenboolfalse

如果為 true,則 SpeedDial 會隱藏。

iconnode-

要在 SpeedDial Fab 中顯示的圖示。SpeedDialIcon 元件提供具有動畫效果的預設圖示。

onClosefunc-

當元件請求關閉時觸發的回呼。

簽名:function(event: object, reason: string) => void
  • event 回呼的事件來源。
  • reason 可以是:"toggle""blur""mouseLeave""escapeKeyDown"
onOpenfunc-

當元件請求開啟時觸發的回呼。

簽名:function(event: object, reason: string) => void
  • event 回呼的事件來源。
  • reason 可以是:"toggle""focus""mouseEnter"
openbool-

如果為 true,則會顯示元件。

openIconnode-

當 SpeedDial 開啟時,要在 SpeedDial Fab 中顯示的圖示。

slotProps{ root?: func
| object, transition?: func
| object }
{}

用於內部每個插槽的屬性。

slots{ root?: elementType, transition?: elementType }{}

用於內部每個插槽的元件。

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

系統屬性,允許定義系統覆寫以及其他 CSS 樣式。

請參閱 `sx` 頁面 以了解更多詳細資訊。

TransitionComponentelementTypeZoom * @deprecated 請改用 `slots.transition`。此屬性將在 v7 中移除。[如何遷移](/material-ui/migration/migrating-from-deprecated-apis/)

用於轉場效果的元件。請遵循本指南以了解有關此元件需求的更多資訊。

transitionDurationnumber
| { appear?: number, enter?: number, exit?: number }
{ enter: theme.transitions.duration.enteringScreen, exit: theme.transitions.duration.leavingScreen, }

轉場效果的持續時間,以毫秒為單位。您可以為所有轉場效果指定單個逾時,也可以使用物件個別指定。

TransitionPropsobject-

應用於轉場效果元素的屬性。預設情況下,元素基於此 Transition 元件。

ref 會轉發到根元素。

主題預設屬性

您可以使用 MuiSpeedDial 透過主題變更此元件的預設屬性。

插槽

插槽名稱類別名稱預設元件描述
root.MuiSpeedDial-root'div'渲染根插槽的元件。
transitionZoom渲染轉場效果的元件。請遵循本指南以了解有關此元件需求的更多資訊。

CSS 類別

這些類別名稱對於使用 CSS 設定樣式很有用。當觸發特定狀態時,它們會應用於元件的插槽。

類別名稱規則名稱描述
.MuiSpeedDial-actionsactions樣式應用於 actions (children 包裝器) 元素。
.MuiSpeedDial-actionsClosedactionsClosed如果 open={false},則樣式應用於 actions (children 包裝器) 元素。
.MuiSpeedDial-directionDowndirectionDown如果 direction="down",則樣式應用於根元素
.MuiSpeedDial-directionLeftdirectionLeft如果 direction="left",則樣式應用於根元素
.MuiSpeedDial-directionRightdirectionRight如果 direction="right",則樣式應用於根元素
.MuiSpeedDial-directionUpdirectionUp如果 direction="up",則樣式應用於根元素
.MuiSpeedDial-fabfab樣式應用於 Fab 元件。

您可以使用以下自訂選項之一覆寫元件的樣式

原始碼

如果您在此頁面中找不到資訊,請考慮查看元件的實作以獲取更多詳細資訊。