带有Material-UI的SVG图标:在哪里可以找到,如何设计样式?

Mad*_*ard 9 svg reactjs material-design material-ui

http://www.material-ui.com/#/components/app-bar上,它说他们支持的可能属性是"iconElementLeft ... element ...要显示在左侧的自定义元素应用程序栏,如SvgIcon."

我现在所拥有的内容不像菜单栏上的其他内容......我指向我找到的svg图标并使用img属性来尝试使用它.我怎样才能制作Material-UI样式它喜欢本土的东西?

export default (props)=>{
return (
    <AppBar
        title={<span style={styles.title}><Link to="/" className="logoLink">GIGG.TV</Link></span>}
        className="header"
        iconElementLeft={<img src='../../public/img/rocket.svg' height='40' width='40' alt='' />}
        // showMenuIconButton={false}
        iconElementRight={
            <IconMenu
              iconButtonElement={
                <IconButton><MoreVertIcon /></IconButton>
              }
              targetOrigin={{horizontal: 'right', vertical: 'top'}}
              anchorOrigin={{horizontal: 'right', vertical: 'top'}}
            >
              <MenuItem
                linkButton={true}
                primaryText="Home"
                containerElement={<Link to="/" className="logoLink">GIGG.tv</Link>} />

              <MenuItem primaryText="Sign in" containerElement={ <SignInModal/>} />
              <MenuItem
                linkButton={true}
                primaryText="Login as Artist"
                containerElement={<Link to="/artistSignIn" >Sign in/Up </Link>} />
            </IconMenu>
          }/>
    )
}
Run Code Online (Sandbox Code Playgroud)

或者,我如何查看Material-UI NPM包中的所有图标,看看它们是否有可能有效的本机?

haz*_*ous 8

两种方式......

  1. 使用SvgIcon内联svg

    使用SvgIcon组件,您可以包含所需的Svg资产.

  2. 导入现有材料-ui资产只需导入变量即可使用它.

    从'material-ui/lib/svg-icons/file/cloud-download'导入FileCloudDownload;

    ...

    iconElementLeft = {FileCloudDownload}

您还将在上面的链接中看到样式示例.

  • 谢谢!对于可能发现此问题的其他人的一个注意事项,材料-ui SVG图标组件页面目前链接到https://design.google.com/icons/,如果您没有看到灰色的白色搜索栏标题,是无法搜索的.他们没有CTRL-F ...... (4认同)