【发布时间】:2022-06-18 21:05:28
【问题描述】:
如何在 MUI 中为自定义样式的组件设置默认道具?目前,我必须在我宁愿加入的每个实例上添加maxWidth="sm"。
const MyContainer = styled(Container)(({ theme }) => ({
marginTop: theme.spacing(2),
}));
...
<MyContainer maxWidth="sm" /> // what I have
<MyContainer /> // what I want
【问题讨论】:
标签: typescript material-ui styled-components