我尝试过MUI AppBar的主题化,但我对主题一无所知。我是否可以在不使用样式组件或其他样式api的情况下使用主题为AppBar样式?
palette.js
import { createTheme } from '@mui/material/styles';
const theme = createTheme({
palette: {
primary: {
main: "#000F04"
}
}
});App.js
import theme from "../../styles/palette";
import { ThemeProvider } from '@mui/material/styles';
const App = () => {
return (
<ThemeProvider theme={theme}>
<AppBar position="static" color="primary">
<Toolbar>
</Toolbar>
</AppBar>
</ThemeProvider>
)
}发布于 2021-09-27 15:05:56
你的密码箱工作。
如果需要添加特定的样式,请使用sx道具。https://mui.com/system/the-sx-prop/
您可以在主题:https://mui.com/customization/theme-components/#heading-global-style-overrides上过度使用样式
https://stackoverflow.com/questions/69345469
复制相似问题