admin管理员组文章数量:1415119
I want to have a "?" icon that users can hover and get specifications on what data they should input into the text field. MUI's default hover is grey with white words, but I'd like mine to be white with grey words, and the font to be bigger. I found that using works well for font-size and color, but when I change background color, there is a grey border around the hover textfield. This is the hover.js ponent:
export default function HoverTip(prop) {
const { tip } = prop
return (
<Tooltip
title={
<Typography
fontSize={15}
backgroundColor={'#ffff'}
color={'#514E6A'}>
{tip}
</Typography>}
arrow
placement="right"
sx={{fontSize: '30'}}
>
<IconButton >
<HelpOutlineIcon />
</IconButton>
</Tooltip>
)
}
However this leaves a black border around the hover textbox. Any idea how to fix this? what it looks like
I want to have a "?" icon that users can hover and get specifications on what data they should input into the text field. MUI's default hover is grey with white words, but I'd like mine to be white with grey words, and the font to be bigger. I found that using works well for font-size and color, but when I change background color, there is a grey border around the hover textfield. This is the hover.js ponent:
export default function HoverTip(prop) {
const { tip } = prop
return (
<Tooltip
title={
<Typography
fontSize={15}
backgroundColor={'#ffff'}
color={'#514E6A'}>
{tip}
</Typography>}
arrow
placement="right"
sx={{fontSize: '30'}}
>
<IconButton >
<HelpOutlineIcon />
</IconButton>
</Tooltip>
)
}
However this leaves a black border around the hover textbox. Any idea how to fix this? what it looks like
Share Improve this question edited May 25, 2023 at 19:19 Ruo asked May 25, 2023 at 19:14 RuoRuo 1271 silver badge13 bronze badges2 Answers
Reset to default 5You can solve this by using the sx
.
Now I found that using it on the Tooltip
directly does not work but you can pass it to the actual tooltip
element using the slotProps
property.
return (
<Tooltip
title={<Typography fontSize={15}>{tip}</Typography>}
arrow
placement="right"
sx={{ fontSize: "30" }}
slotProps={{
tooltip: {
sx: {
color: "#514E6A",
backgroundColor: "#ffff",
},
},
}}
>
<IconButton>
<HelpOutlineIcon />
</IconButton>
</Tooltip>
);
<Tooltip
PopperProps={{ sx: { '.MuiTooltip-tooltip': { bgcolor: 'green' } } }}
title="green"
>
<SomeIcon />
</Tooltip>
本文标签: javascriptHow to change the background color of a MUI tooltipStack Overflow
版权声明:本文标题:javascript - How to change the background color of a MUI tooltip? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745221137a2648400.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论