christianalfoni / webpack-bin

A webpack code sandbox
http://www.webpackbin.com
MIT License
710 stars 75 forks source link

How to import Material UI icons #177

Open lucasbento opened 7 years ago

lucasbento commented 7 years ago

How do I import Material UI icons from the npm package?

Material UI syntax is import MoreVertIcon from 'material-ui/svg-icons/navigation/more-vert'; which does not work on webpack-bin, is there another way for it?

Thank you.

Sharlaan commented 7 years ago

Interested in answer, i got same error as well ...

lucasbento commented 7 years ago

@Sharlaan: I'm currently using only material icons with <FontIcon /> component, working fine. :)

Sharlaan commented 7 years ago

Can you elaborate with some code example please ?

I usually don't use css at all (CSSinJS), so not sure if this needs to use some css classes + url (and which url ?) ?

lucasbento commented 7 years ago

@Sharlaan: something like this: http://www.webpackbin.com/4ki4undA-

Sharlaan commented 7 years ago

Thanks deeply for the Code Example and fast answers :) It works

Just a warning, if material icon 's name has a '-', replace it with underscore '_' like this:

const DropDownArrow = <FontIcon className='material-icons'>arrow_drop_down</FontIcon>
mukkachaitanya commented 7 years ago

@lucasbento Hey the link you put up seems to be broken. Do you still have the code to share?

narita-bagchi commented 6 years ago

The link is broken.