reactjs - Material UI <IconButton> 未显示

标签 reactjs material-ui

我正在使用 Material UI ,我有以下几点:

import IconButton from 'material-ui/IconButton';
<IconButton iconClassName="muidocs-icon-custom-github" tooltip="bottom-right" tooltipPosition="bottom-right" />

当我测试工具提示时,图标没有显示,但工具提示在悬停时显示。有人可以帮我创建一个例子吗?我错过了图标 URL 吗?

最佳答案

这似乎是 Material-UI 文档的问题。检查这个 Link更多细节

如果你想放置 github 图标,那么你可以尝试使用 SVG Icon。看来您必须在 index.html 中包含 google material icons 样式表才能使其工作。

<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">

通常,如果我们想使用 svg 图标,我会按照以下方式进行。
import IconButton from 'material-ui/IconButton';
import Remove from 'material-ui/svg-icons/Content/remove';

<IconButton tooltip="Hide" style={{float: 'right'}}  iconStyle={{marginTop: -25, color: myTheme.color}} onClick={this.removeMinus}>
   <Remove color=“red” />
</IconButton>

关于reactjs - Material UI <IconButton> 未显示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48302581/

相关文章:

reactjs - Jest/Enzyme document.createRange 不是挂载函数

javascript - 通过 onFocus 属性中的事件对象获取 TextField(作为选择框)Material-UI 的名称属性

javascript - 如何更改悬停时的图标颜色?

reactjs - 在具有亮/暗模式的自定义 MUI 组件变体中使用主题调色板颜色

javascript - react : How to convert JSON Object to Array and render it?

javascript - (ReactJS)循环嵌套数组创建表数据时出错

reactjs - 如何使用 Material ui 实现服务器端分页并使用react?

material-ui - 如何在 Material UI 中更改框颜色

reactjs - 在 firebase.utils.js 的函数内传递 props

reactjs - 如何在react中编写内联样式