[英]How to override Material-UI Popover Paper styles?
基本上,我试图覆盖一种在程序中自动引入的样式。 当我使用Popover时,我的程序中会自动具有MuiPopover-paper样式,我必须在此类中更改一些样式,但是如何?
.MuiPopover-paper {
outline: none;
position: absolute;
max-width: calc(100% - 32px);
min-width: 16px;
max-height: calc(100% - 32px);
min-height: 16px;
overflow-x: hidden;
overflow-y: auto;
}
code part
const styles = (theme: Theme) => {
return createStyles({
notifications: {
width: 449,
height: 400,
overflow: 'auto'
},
settings: {
width: 300,
height: 360
}
})
}
覆盖组件样式的方法之一是使用classes对象prop的规则名称。 从Popover的MUI API文档中可以看到,您可以覆盖应用于Paper组件的样式:
<Popover classes={{ paper: "MuiPopover-paper" }} />
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.