我有这个TabPane:
我一直在试着去掉衬垫。根据一些关于SO的回答,这是我需要做的:
<TabPanel
value={value}
index={i}
classes={{
"& .MuiBox-root": {
padding: "0px",
},
}}
>
但这并没有产生任何效果。
当我检查页面时,我发现我必须删除MuiBox-root-9来删除填充。删除MuiBox-root没有任何效果:
<div class="MuiBox-root MuiBox-root-9">
我不知道如何针对这个类MuiBox-root-9。
如果我没记错的话TabPanel
is the component you created 是你创建的组件,而不是从材料,所以如果你遵循这个例子。
function TabPanel(props) {
const { children, value, index, ...other } = props;
return (
<div
role="tabpanel"
hidden={value !== index}
id={`simple-tabpanel-${index}`}
aria-labelledby={`simple-tab-${index}`}
{...other}
>
{value === index && (
<Box sx={{ p: 3 }}>
<Typography>{children}</Typography>
</Box>
)}
</div>
);
}
你可以移除sx={{p: 3}}使你的面板没有填充。