警示標題API
React AlertTitle 組件的 API 參考文件。了解此匯出模組的 props、CSS 和其他 API。
範例展示
匯入
import AlertTitle from '@mui/material/AlertTitle';
// or
import { AlertTitle } from '@mui/material';
請閱讀這份關於最小化 bundle size 的指南,以了解差異。
Typography 組件的 Props 也可使用。
名稱 | 類型 | 描述 |
---|---|---|
children | node | 組件的內容。 |
classes | object | 覆寫或擴展應用於組件的樣式。 請參閱下方的 CSS classes API 以了解更多詳細資訊。 |
sx | Array<func | object | bool> | func | object | 系統 prop 允許定義系統覆寫以及額外的 CSS 樣式。 請參閱 `sx` 頁面以了解更多詳細資訊。 |
`ref` 會傳遞到根元素。
繼承
雖然上方未明確記錄,但 Typography 組件的 props 也可在 AlertTitle 中使用。您可以利用這一點來 target nested components。
這些 class name 對於使用 CSS 設定樣式很有用。它們在觸發特定狀態時會應用於組件的 slots。
Class name | Rule name | 描述 |
---|---|---|
.MuiAlertTitle-root | root | 應用於根元素的樣式。 |
您可以使用以下其中一種自訂選項來覆寫組件的樣式
- 使用全域 class name。
- 在自訂主題中,使用 rule name 作為組件的 `styleOverrides` 屬性的一部分。
原始碼
如果您在此頁面中找不到資訊,請考慮查看組件的實作以了解更多詳細資訊。