I am using the example project, I added an AppBar to main.jsx:
render() {
return (
<div style={containerStyle}>
<AppBar
iconElementRight={ <IconButton iconClassName="muidocs-icon-custom-github" tooltip="GitHub"/> }
title="PR-Stat"
/>
<Dialog
actions={standardActions}
onRequestClose={this._handleRequestClose}
open={this.state.open}
title="Super Secret Password"
>
1-2-3-4-5
</Dialog>
<h1>material-ui</h1>
<h2>example project</h2>
<RaisedButton label="Super Secret Password"
primary={true} onTouchTap={this._handleTouchTap} />
</div>
);
},
the muidocs-icon-custom-github
icon does not show the github icon. An IconButton with such a class name is described in the docs
You are right, the className is from the doc source code: https://github.com/callemall/material-ui/blob/master/docs/src/www/css/font-icons/style.css#L59.
@subjectix We should address this during the migration of the doc to make the examples more standalone.
@oliviertassinari Yes definitely! :+1:
so... how do I get the icon to show up?
@leshow For the FontIcon
component, you need to have
.muidocs-icon-custom-github:before {
content: "\e625";
}
and to import the font
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
I added that to my main.css and index.html (i'm using the gulp/react example app) and the icon was replaced with the rectangle with an 'X' in it, the icon missing icon. So that still didn't do it. Where are you getting the content
CSS from?
Ah, nevermind. I was missing some more CSS from that file
heeey, this seems to have happened a while back, but I'm having the same issue... The github icon DOES NOT show up :( even after having added that bit of .css into my
Most helpful comment
I really can't say why this ticket was closed. For newcomers this is very confusing.
The solution proposed here, please correct me if wrong, is to copy the whole CSS code found in this link (coming from the docs source code). While this works, it can't really be the solution.
The solution should be to use the Font Icon component like this (this is for Material Icons):
You will still need to import the Material Icons font in
index.html
:<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
Can someone please confirm?