New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Icon] Allow customizing the 'material-icons' base class name #23613
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll repeat here what I said numerous times. The Icon component is for usage with Material-UI which is why it is published form @material-ui/core
.
If you need it for different purposes I'd recommend copying it and adjusting it for your own purposes.
@eps1lon perhaps the docs referencing that it can be used with other fonts too is a source of confusion then? Event if it is to be used with only material ui, material icons have the various base classes for the different icon variants (rounded, sharp, two-tone) so I felt it makes sense anyway. From your comment, I understand I should just go ahead and close this PR as it won't be accepted? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Icon component is for usage with Material-UI which is why it is published form @material-ui/core.
@eps1lon I don't follow the reasoning. Soon or later, developers need to add icons that aren't available in http://material.io/. We need a story to extend it. The value for using the component range between the integration with the theme, the extra features we apply, the right set of defaults. I think that the Icon
should be able to host any font icons so is the SvgIcon
to host any SVG icons. Material-UI !== Material Design. I think that Vuetify does it correctly: https://vuetifyjs.com/en/features/icons/.
…e framer build`. Address Olivier's PR reviews: baseClass => baseClassName, small tweak to docs
updated to keep emphasize on material.io/icons with the two-tone
5a9fc9c
to
2c18f0c
Compare
What a about taking the base class name from the className prop: If the className contains two values, the first values overrides the base classname. So no API change, and more concise. -<Icon baseClassName="fas" className="fa-plus-circle" />
+<Icon className="fas fa-plus-circle" /> |
@mbrookes The current proposal allows to leverage <Icon baseClassName="fas" className="fa-plus-circle" /> At least, I wouldn't. I would configure the base class name once, abstract it, somehow. <Icon className="fa-plus-circle" /> We might want to document this. |
Good point. That seems worth adding to the docs. |
```jsx | ||
<Icon>add_circle</Icon> | ||
``` | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Ok?
No? How did you make the logical jump? |
And please don't dismiss my reviews. Unless you don't want to me review PRs |
@eps1lon Do you mean the logical jump between 1. developers need more icons than the one available in the filled theme of Material Design and 2. we need a story to extend it? 1. is the problem 2. is the solution. I believe we already support it. Developers can apply the Still why?
|
The
Icon
component always adds thematerial-icons
class to the element; however, per the docs, you may use other icon fonts with this component so always having this base class doesn't make sense in all cases. Best case scenario, the class is ignored but if someone is mixing two icon fonts (material-icons + some other), this may cause issues.Also, now that the different Material Icon variants can be used via icon font, it would be convenient to be able to swap out
material-icons
formaterial-icons-round
, for example.