英文:
I want to set the background color of my mui Tooltip to Red and text color to White
问题
<Tooltip
placement="left"
classes={{
tooltip: "classes.customTooltip",
arrow: "classes.customArrow",
}}
title="Reverse POS Update"
arrow
>
<IconButton aria-label="edit" onClick={() => handleEdit(params.id)}>
<SyncAltRoundedIcon className="reversebtn" />
</IconButton>
</Tooltip>
{
field: "TickToDelete",
headerName: "Delete",
width: 70,
sortable: true,
renderCell: (params) => {
return (
<Tooltip title="Delete" placement="right">
<IconButton aria-label="edit" onClick={() => handleEdit(params.id)}>
<DeleteIcon />
</IconButton>
</Tooltip>
);
},
}
英文:
`<Tooltip
placement="left"
classes={{
tooltip: "classes.customTooltip",
arrow: "classes.customArrow",
}}
title="Reverse POS Update"
arrow
>
<IconButton aria-label="edit" onClick={() => handleEdit(params.id)}>
<SyncAltRoundedIcon className="reversebtn" />
</IconButton>
</Tooltip>`
I am Using Datagrid and in one of the column i used and icon instead of button and i apply a tooltip of mui on hover and my icon is of red color and i also want my tooltip to be red.
{
field: "TickToDelete",
headerName: "Delete",
width: 70,
sortable: true,
renderCell: (params) => {
return (
<Tooltip title="Delete" placement="right">
<IconButton aria-label="edit" onClick={() => handleEdit(params.id)}>
<DeleteIcon />
</IconButton>
</Tooltip>
);
},
},
答案1
得分: 2
在MUI5中,您可以使用componentsProps
自定义<Tooltip/>
的样式。查看下面的示例 👇
<Tooltip
title="Delete"
open={true}
componentsProps={{
tooltip: {
sx: {
bgcolor: "red",
color: "white"
}
}
}}
>
希望这对您有所帮助。
英文:
In MUI5, You can customize styling of <Tooltip/>
using componentsProps
. Check the example below 👇
<Tooltip
title="Delete"
open={true}
componentsProps={{
tooltip: {
sx: {
bgcolor: "red",
color: "white"
}
}
}}
>
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论