Material UI 上的 IconButton 悬停效果
下面我有来自 Material UI 的不同图标,当前每当我将鼠标悬停在其中任何一个图标上时,它都会显示一个灰色圆圈,我想删除这个灰色圆圈,并且我希望每个图标在我将鼠标悬停在其上时都更改为特定颜色我查看了Material ui 中的文档,但找不到任何解释它的内容,感谢您的反馈。
<Box className={classes.socialmedia}>
<IconButton aria-label="twitter">
<TwitterIcon />
</IconButton>
<IconButton aria-label="facebook">
<FacebookIcon />
</IconButton>
<IconButton aria-label="instagram">
<InstagramIcon />
</IconButton>
<IconButton aria-label="Youtube">
<YouTubeIcon />
</IconButton>
<IconButton aria-label="Apple">
<AppleIcon />
</IconButton>
</Box>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
为了删除悬停在背景中的灰色圆圈,您可以使用
disableFocusripple
&amp;disableripple
iconbutton中的属性组件和setstyle = {{backgroundColor:'透明'}}}
。例如:
要更改悬停图标的颜色,然后使用
悬停
选择器。例如:
我创建了一个快速示例来说明CODESANDBOX中的解决方案:
https://codesandbox.io/s/elegant-ramanujan-wnj9fw?file=/index.js:948-961
In order to remove the grey circle displaying in background on hover then you can use
disableFocusRipple
&disableRipple
property in IconButton component and setstyle={{ backgroundColor: 'transparent' }}
.Ex:
To change the color of icon on hover then use
hover
selector.Ex:
I've created a quick example to illustrate the solution in codesandbox:
https://codesandbox.io/s/elegant-ramanujan-wnj9fw?file=/index.js:948-961
定义钩子。导入
makestyle
来自'@Iterity-ui/core/styles'
。然后在您的组件中:
Define a hook. Import
makeStyle
from'@material-ui/core/styles'
.Then in your component: