RaLabeled classname not applied properly
See original GitHub issueWhat you were expecting: We’re migrating over to RA 4, and we’ve noticed difficulties with applying style overrides to labelled components.
In the theme object we’re applying the following overrides:
RaLabeled: {
styleOverrides: {
label: {
fontSize: "1.4em",
color: PrimaryColors.Black,
border: "1px solid red",
opacity: 0.87,
fontWeight: 500,
},
},
},
But these styles aren’t being applied in the app because the classname being generated by RA is the following:

This might be a red herring, but it seems that our styles may not be applied properly because the Labeled component’s root cass class is css-8l66u2-MuiStack-root-RaLabeled-root
. And it seems we can no longer target it via the theme object.
Do you have a codesandbox that uses RA v4 beta? If so i can create a repro case easily without having to pull from the repo
insert short code snippets here
Other information:
Environment
- React-admin version: 4.0.0-beta.1.0
- Last version that did not exhibit the issue (if applicable):
- React version:
- Browser:
- Stack trace (in case of a JS error):
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (6 by maintainers)
Top Results From Across the Web
className not being correctly applied after server render
Notice that the background is green and the text reads CONTAINER--LARGE (should be blue). The text was server rendered as container--small ( ...
Read more >Css classname not applied to react component - Stack Overflow
Firstly, you need to guarantee it's defined with: console.log(styles) Im' not sure you import style.scss correctly.
Read more >The Basics - Manual - PHP
The class name can be any valid label, provided it is not a PHP reserved word. A valid class name starts with a...
Read more >How to fix className styles not working in React and JavaScript
In this tutorial we can resolve className styles not working in React and JavaScript.Just rename the the css or scss file to filename.module ......
Read more >className of leaflet popup option does not apply to the ...
I have a problem similar to this post. Basically, the CSS is not applying to the element I am trying to target, and...
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
That’s because most of the default inputs don’t use the
Labeled
component but leverage the defaults of MUI instead.I forked the codesandbox to show how to customize MUI labels and added a
Labeled
so that you can check it works.https://codesandbox.io/s/modern-wave-q63dwi?file=/src/comments/CommentEdit.tsx
Thanks a lot!