-
-
Notifications
You must be signed in to change notification settings - Fork 31.7k
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
[ListItemText] Text styles are being overruled by unexposed Typography component styles #7067
Comments
Some thought on the issue:
|
I like that solution a lot. It provides the flexibility needed and matches an existing pattern. I've forked and pushed the solution here. Should I open a PR? |
@zachwolf Yes, that would be awesome! |
@oliviertassinari @zachwolf I'm running into this issue at the moment and was wondering if we could change the CSS API for the ListItemText component. The problem is the text class is only applied to the Typography component when the List is dense. Ideally, there would be two classes:
There may be an argument for breaking it into classes for primary, secondary, but this would be a simple and clear offering. At this point, the text class is confusing, but the other classes make sense:
It is worth noting that changing the CSS API as I've suggested would be a breaking change, since anyone using the text class is intending on styling the ListItemText's inner Typography in a dense List. I know I can disableTypography and set primary to my own JSX, but it would be easier if all I want to do is change the appearance of the text in a minor way. Let me know if this sounds good and I'll submit a PR. |
I agree.
Hummmm, given the change you are proposing is simple, I think that we can move forward into that direction 👍 . |
@oliviertassinari thanks, PR submitted |
* [ListItemText] Repurpose text class - Expose text as a class that can be used to style the inner Typography component, whether the List is dense or not - Add new textDense class that can be used to specifically style the Typography component when the list is dense - Reference to closed issue #7067 * Update ListItemText.js
* [ListItemText] Repurpose text class - Expose text as a class that can be used to style the inner Typography component, whether the List is dense or not - Add new textDense class that can be used to specifically style the Typography component when the list is dense - Reference to closed issue mui#7067 * Update ListItemText.js
Hello,
Sorry if this topic has already been raised, I've searched through the open and closed issues but haven't found anything that matches it. Possibly this, but they didn't provide enough info.
Problem description
I'm trying to apply styling to a
<ListItemText>
component. The issue is that the component wraps the content in a<Typography>
component. This<Typography>
component has its own styles, I believe the only way to style them as it is today would be to style them globally with thetheme
. This is only an issue when trying to apply specific styles such as text color.In other words, given something like this:
This is what's rendering:
In the CSS section of the screenshot above, the class and style are getting applied correctly. However, the component's text is not red. This is because a more specific style is applied one child below:
I think the simplest fix would be to either expose the
Typography
componentscolorInherit
prop or set it to always true. So, something like:🎩:
I can submit this change in a PR, if it looks like an ok fix.
Link to minimal working code that reproduces the issue
Simplified app
Specific lines
Versions
The text was updated successfully, but these errors were encountered: