Material-ui: How to use Icon ?

Created on 15 Jun 2015  ·  3Comments  ·  Source: mui-org/material-ui

I've installed the library with npm install material-ui .
When i use the component <FontIcon className='mui-icon-sort' /> , there is no icon to show.
Do you know how to resolve this ?

Most helpful comment

@checkraiser You need to add the Google font library in your project in order to use icons with <FontIcon> method . Alternatively you can add Google material icons from Google web fonts <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet"> and use the icons as mentioned below:

<RaisedButton>
    <i className="material-icons" style={{color: 'white'}}>sort</i>
</RaisedButton>

<FloatingActionButton>
    <i className="material-icons" style={{color: 'white'}}>sort</i>
</FloatingActionButton>

All 3 comments

@checkraiser You need to add the Google font library in your project in order to use icons with <FontIcon> method . Alternatively you can add Google material icons from Google web fonts <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet"> and use the icons as mentioned below:

<RaisedButton>
    <i className="material-icons" style={{color: 'white'}}>sort</i>
</RaisedButton>

<FloatingActionButton>
    <i className="material-icons" style={{color: 'white'}}>sort</i>
</FloatingActionButton>

Thanks @mairh - There's also this issue to provide support for the google font library inside the library. See #829

@mairh cant we use the icons from Material-UI ?
including Google Material UI Font library destroys the purpose, also it is 48KB

Was this page helpful?
0 / 5 - 0 ratings