我已将 MUI 从 v4 升级到 v5。但是,我现在很难理解主题如何与可用的不同主题解决方案一起使用。我不太明白在哪里使用 MUI 主题/样式组件以及何时使用情感组件。
在新组件中,我使用sxprop 来应用样式,但是我有很多组件仍在使用createStyles/useStyles函数。
我目前有以下设置:
import {
ThemeProvider as MuiThemeProvider,
Theme,
StyledEngineProvider,
createTheme,
} from "@mui/material/styles";
import { ThemeProvider } from "@emotion/react";
declare module "@mui/material/styles" {
interface Theme {
mycompany: {
primary: string;
};
}
// allow configuration using `createTheme`
interface ThemeOptions {
mycompany: {
primary: string;
};
}
}
declare module "@mui/styles/defaultTheme" {
// eslint-disable-next-line @typescript-eslint/no-empty-interface
interface DefaultTheme extends Theme {}
}
const theme = createTheme({
mycompany: …Run Code Online (Sandbox Code Playgroud) 我正在尝试在(模式)内使用下拉选择Dialog。但是,选项会被模式的底部切断。我怎样才能获得继续向下越过底部边界的选项?
我正在使用 MUI v5。
<Dialog open={open}>
<DialogContent>
<Autocomplete
disablePortal
id="combo-box-demo"
options={options}
// getOptionLabel={(option) => option}
sx={{ width: 300 }}
renderInput={(params) => <TextField {...params} label="Numbers" />}
/>
</DialogContent>
</Dialog>
Run Code Online (Sandbox Code Playgroud)
(极端)示例:代码沙箱