我有一个使用NextJS和MaterialCSS的应用程序,并创建了以下主题:
import { createTheme } from '@mui/material/styles';
export const darkTheme = createTheme({
palette: {
mode: 'dark',
},
components: {
MuiButton: {
styleOverrides: {
root: {
color: 'white',
},
},
},
},
});
export const lightTheme = createTheme({
palette: {
mode: 'light',
},
});
我知道如何为Mui组件覆盖样式。 如何为我的主题中的<h3>元素定义自定义样式,以便在暗主题上具有不同的h3样式而在亮主题上具有不同的h3样式?
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
const theme = createTheme({ typography: { h3: { fontSize: 30, }, subtitle1: { fontSize: 12, }, body1: { fontWeight: 500, }, button: { fontStyle: 'italic', }, }, });文档:
https://mui.com/material-ui/customization/typography/#variants