-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
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
[FormLabel] Style overrides with variants do not work #44699
Comments
@Gopikrishna19 Would you mind providing a repro in CodeSandbox/stackblitz? |
@mj12albert sorry about the delay. Here you go :) Testing: comment/uncomment the ways of overriding the styles, and in the devTools > Elements tab, search for Two notes: The sandbox uses 6.1.10, and I used blue as opposed to the reported color black for the font to make it apparent. |
@Gopikrishna19 Hey thanks for the repro, I'm not sure what your exact use-case is, but does using |
I am trying to implement this example: https://mui.com/material-ui/react-checkbox/#formgroup. I thought InputLabel was for TextField and Input components, while FormLabel was for form controls. Do you know if my understanding is incorrect? Overloading InputLabel seems like a hassle though, trying to identify where it is used. As to why I want to use it, its just code style and code consistency. Every component we are overriding now is using the variants API, which is cleaner than the big blob of CSS on the root. Either way, the variant API should be consistent, shouldn't it? I am finding out FormControl doesn't work as well. Has the same |
Additional components with same issues: |
Hey! This seems to be a bug caused by material-ui/packages/mui-material/src/FormLabel/FormLabel.js Lines 36 to 38 in a491dc2
Here, For comparison, see the Button's implementation: material-ui/packages/mui-material/src/Button/Button.js Lines 80 to 81 in a491dc2
This is also true for the other reported components: These are the only ones that destructure Changing these to follow the Button's implementation fixes the issue. @siriwatknp, you're more familiar with the implementation of variants. Does this make sense? |
Hi @DiegoAndai I have started to work on it. I hope that's okay? |
MuiAutocomplete-popupIndicator is also not working |
@siddhantantil39 Thanks,assigned you ~ |
Looks like those are only finds? https://github.com/search?q=repo%3Amui%2Fmaterial-ui+...styles.root+path%3A%2F%5Epackages%5C%2Fmui-material%5C%2Fsrc%5C%2F%2F&type=code I shall let you folks know if I find anything else. Thank you all for the quick resolution ❤️ ❤️ ❤️ |
@mj12albert I have added the changes in my PR. Can anyone please review the PR. |
Yes, that makes sense. It should always be an array. |
This issue has been closed. If you have a similar problem but not exactly the same, please open a new issue. Note @Gopikrishna19 How did we do? Your experience with our support team matters to us. If you have a moment, please share your thoughts in this short Support Satisfaction survey. |
Sandbox
https://codesandbox.io/p/sandbox/https-github-com-mui-material-ui-issues-44699-xgdw5j
Steps to reproduce
Plug this in the
createTheme
component overrides:Current behavior
It generates a stylesheet with a
1
in it.Expected behavior
it should not have
1
in it, just like other components.Context
Applying custom style to FormLabel component through
createTheme
. Usingroot
as a function is the alternative that works. But I'd like to stay consistent with the variant override code style.Your environment
npx @mui/envinfo
Search keywords: FormLabel, form-label, form label style
The text was updated successfully, but these errors were encountered: