-
-
Notifications
You must be signed in to change notification settings - Fork 32.5k
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
[Button] Multiple variant styles being applied #11932
Comments
@murtyjones An outlined button is a flat button with a border, so this is an efficient reuse of styles, rather than duplicating them. We could:
(cc @leMaik ) |
@mbrookes Not I'm aware of. I think that we should aim for a simple class name application logic. Trading CSS duplication for variant isolation is a tradeoff Bootstrap has been taking. It can help in simplifying the class name combination logic. |
That's a heck of a lot of styles to duplicate in the button - for example all the contained (raised) styles are used for the FAB. |
@mbrookes I'm not saying we should duplicate. A tradeoff needs to be done. We can always keep the current one. |
Alright, I'm keeping the current tradeoff and trying to simplify the rendering logic. |
Are there implications from the linked PR to this issue? Sounds like I should create custom classes if I want the default styling of the outlined variant to differ from the default styling of the flat variant - is that right?
…
|
I have tried to simplify the classname logic in the linked pull request. You should be able to use the |
Expected Behavior
When a variant is chosen, e.g.
outlined
, other variants such asflat
should not be applied as classes.Current Behavior
The button element has multiple classes applied to it despite the variant applied.
E.g. for an outlined button i'm seeing flat, flatSecondary, etc:
Steps to Reproduce (for bugs)
Open up this sandbox example, then right-click and inspect the button element. You'll see the outlined variant in the classes, but also the flat variant.
https://codesandbox.io/s/8103lzm9q9
Context
I noticed this when the
outlined
variant of the MUI button had some of theflat
styling properties I applied at the theme level.Your Environment
The text was updated successfully, but these errors were encountered: