MuiListItemText-secondary overrides custom theme color for typography variant
See original GitHub issueWhen using a <ListItemText/>
component with the secondaryTypographyProps
set to use a custom variant with a color
value, the default color rgba(0, 0, 0, 0.6)
overrides the custom variant color.
- The issue is present in the latest release.
- I have searched the issues of this repository and believe that this is not a duplicate.
Current Behavior 😯
Setting a custom theme color gets overridden by the default palette.text.secondary
.
Expected Behavior 🤔
Setting the color
attribute for a custom typography variant should display properly
Steps to Reproduce 🕹
https://codesandbox.io/s/muilistitemtext-bug-6y9k1
Custom theme…
typography: {
header3Bold: {
color: Constants.arrivedDark,
fontFamily: apercuFonts,
fontSize: getFontSize(700, isMobile),
fontWeight: 700,
lineHeight: '1.133em',
},
},
Context 🔦
Using a custom typography variant with the color
css attribute gets overridden by the default palette.text.secondary
.
Your Environment 🌎
`npx @material-ui/envinfo`
System:
OS: macOS 11.4
Binaries:
Node: 15.14.0 - ~/.nvm/versions/node/v15.14.0/bin/node
Yarn: Not Found
npm: 7.14.0 - ~/.nvm/versions/node/v15.14.0/bin/npm
Browsers:
Chrome: 91.0.4472.114
Edge: Not Found
Firefox: Not Found
Safari: 14.1.1
npmPackages:
@emotion/react: ^11.1.5 => 11.1.5
@emotion/styled: ^11.3.0 => 11.3.0
@material-ui/codemod: ^5.0.0-alpha.35 => 5.0.0-alpha.35
@material-ui/core: ^5.0.0-alpha.38 => 5.0.0-alpha.38
@material-ui/icons: ^5.0.0-alpha.37 => 5.0.0-alpha.37
@material-ui/lab: ^5.0.0-alpha.38 => 5.0.0-alpha.38
@material-ui/private-theming: 5.0.0-alpha.36
@material-ui/styled-engine: 5.0.0-alpha.34
@material-ui/system: 5.0.0-alpha.38
@material-ui/types: 6.0.1
@material-ui/unstyled: 5.0.0-alpha.38
@material-ui/utils: 5.0.0-alpha.36
@types/react: ^17.0.2 => 17.0.3
react: ^17.0.2 => 17.0.2
react-dom: ^17.0.2 => 17.0.2
styled-components: ^5.2.1 => 5.2.3
typescript: ^4.2.3 => 4.2.4
Issue Analytics
- State:
- Created 2 years ago
- Comments:10 (7 by maintainers)
Top Results From Across the Web
Set Typography text color in MUI - reactjs
I would try this - Include a typgraphy property in your theme, something like below with an 'h3' variant ...
Read more >[theme] Allow custom typography variants · Issue #22257
MUI allows you to add custom keys to the theme configuration. However, there is no way to expand the design system unless you...
Read more >Theming - Material UI
Customize MUI with your theme. You can change the colors, the typography and much more. The theme specifies the color of the components,...
Read more >MUI V5: Themes (custom colors + fonts, dark mode ... - YouTube
In this video we go over Material UI V5's Theming! This is a big one, and probably the most important thing to know...
Read more >Material-UI Typography Tutorial and Examples
The default <Typography> with no props will render a body1 variant, which is just a <p> ... To set a custom color, font-weight...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@mnajdova because the color is forced in the
ListItemText
, that’s why the color from theme (typography variant) is overridden.Ok, I’ll go with a one-off styled solution. I’ll keep following this to see where we land with the order of priority in terms of colors on the secondary text.