我在数据网格(Pro)中有一个动作按钮:
<GridActionsCellItem icon={ <EditIcon/> } />
如何使用主题将color="inhereted"
或color="#123"
放置到所有动作图标按钮中?
我想让我所有的动作图标按钮默认为相同的颜色。
发布于 2022-10-30 11:48:09
如果您想在您的theme
中设置更改,下面的代码应该适用于您。
MuiDataGrid: {
root: {
'& .MuiDataGrid-actionsCell': {
'& .MuiSvgIcon-root': {
color: 'red'
}
}
}
}
或者您可以使用像这样的样式组件
const GridActionsCellItemStyled = styled(GridActionsCellItem)(({ theme }) => ({
"& .MuiSvgIcon-root": {
color: "red"
}
}));
<GridActionsCellItemStyled
icon={<EditIcon />}
label="Edit"
/>,
https://stackoverflow.com/questions/74236701
复制相似问题