Extending a variant does not override its styles
See original GitHub issueDescribe the bug I would not only extend a variant but also alter some of its defined styles. In my case I’m defining some heading style and would like to extend those by overriding color.
To Reproduce define the following in your config:
colors: {
text: '#000',
primary: '#f00',
},
text: {
heading: {
fontFamily: 'heading',
fontWeight: 'heading',
lineHeight: 'heading',
color: 'text'
},
headingLight: {
variant: 'text.heading',
color: 'primary'
}
}
and use <Heading variant='headingLight'>Testing</Heading>
somewhere.
Expected behavior Headline should be red, but it is using the text color.
Additional context
It works if you remove color: 'text'
from the headling
variant.
Issue Analytics
- State:
- Created 4 years ago
- Comments:7 (5 by maintainers)
Top Results From Across the Web
MUI v5 - Extending Typography variant in TypeScript creates ...
Show activity on this post. I am setting up the base for an app with MUI v5 and TypeScript.
Read more >Create and use variants - Figma Help Center
You can override Figma's default behavior and arrange variants in any way you choose. Select a variant and move it to new co-ordinates...
Read more >Adding Custom Styles - Tailwind CSS
This guide covers topics like customizing your design tokens, how to break out of those constraints when necessary, adding your own custom CSS,...
Read more >Theming Bootstrap
Every Sass variable in Bootstrap 4 includes the !default flag allowing you to override the variable's default value in your own Sass without...
Read more >Advanced (LEGACY) - MUI System
⚠️ @mui/styles is the legacy styling solution for MUI. It depends on JSS as a styling solution, which is not used in the...
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
I’d absolutely love this. For example, I have a set of container styles, & they’re mostly the same, but I want to change the
maxWidth
on each one. Some basic composition/overrides like this would shorten my theme enormously.I revisited the components recently and now its working as expected. Not sure if it was related but having to pass down
className
all the time wasnt clear to me before reading through https://github.com/system-ui/theme-ui/issues/396 Maybe a high level explanation in the docs@Guides/HowToBuildYourOwnComponent so people can start with an example from there. Thanks for all the work btw, its amazing to work with!