[theme] Custom Variant
See original GitHub issue- This is not a v0.x issue.
- I have searched the issues of this repository and believe that this is not a duplicate.
Expected Behavior 🤔
I would love the ability to use a variant with any string and with that variant I could style the component using theme overrides. For example, let’s say I have 4 types of buttons throughout my app and each button has a custom variant, inside theme I would simply use MuiButton
with my custom variant names and style them as I please. The variant would act as an identifier and would give the theme more flexibility in styling the entire app and it would not tie me down to a preset list of variants.
Current Behavior 😯
Currently variants are limited and come with additional styling.
Context 🔦
Limits my ability to use theme to a greater extent and pushes me to style more locally than globally.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:84
- Comments:32 (10 by maintainers)
Top Results From Across the Web
Creating custom variants with Material-UI - Stack Overflow
In Material-UI v5, you can easily create a new variants for your components (See the list of supported components in this RFC) using ......
Read more >Variants - Theme UI
Variants allow you to define the styles used across multiple buttons, typographic elements, or any element in your theme object. For example, you...
Read more >Components - MUI
You can use the variants key in the theme's components section to add new variants to MUI components. These new variants can specify...
Read more >[theme] Custom Variant · Issue #15573 · mui/material-ui - GitHub
I am interested in creating custom variant in Typography. It seems to be working, however there are errors in console. Theme: const theme...
Read more >Theme Variants | Styling and Themes | Flow | Vaadin 14 Docs
Custom variants allow you to freely customize the visual appearance of components. They are defined in an additional stylesheet which you import as...
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 Free
Top 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
Thanks for your responses. @oliviertassinari , I don’t believe they are the same. Currently for
Button
I have these variants accessible to me:Given two buttons, one with an
outlined
variant and the other without, the theme can target the button with the variant and style it specifically like this:The feature I would hope for is that a variant of any name can be applied and targeted through the theme. It would look something like this:
The variant would act as an identifier that could be accessed through the theme. So instead of applying unique styles to every component I would centralize my styles in one place.
MaterialUI has been a pleasure to work with but I’m surprised about the lack of support for custom colors/variants. I see this is bookmarked for v5 but the Oct. 2020 due date is some time away. Are there any updates / plans to support this in v4?