-
-
Notifications
You must be signed in to change notification settings - Fork 32.3k
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
[Base] Slot class names are inconsistent #33260
Comments
Thanks for reporting this. AFAIK we settled on |
Cool, that naming pattern works for me! 👍 |
@michaldudak Is there a discussion about it we can link to? I wonder if we shouldn't enforce import { BadgeUnstyled } from '@mui/material'; then I would expect the class name to be prefixed with import { InputUnstyled, inputUnstyledClasses } from "@mui/material" shouldn't he expect It could be a great new conformance test to add to our test suite 👼 Regarding Joy UI and Material UI both use |
@oliviertassinari My vote would be for either Since Material UI owns |
@samuelsycamore This seems to make the assumption that we should optimize for developers to be able to easily know if a component is from MUI Base or Material UI component. Should it be? Why? => IMHO, the className names should optimize for making it easier to customize the components.
Actually, they don't: proof https://mui.com/joy-ui/react-switch/#introduction, my expectation was off. Joy UI uses @michaldudak I think that I have found a different problem. In https://mui.com/joy-ui/react-badge/#introduction the classes on the root is |
@oliviertassinari if there are no downsides to enforcing a single naming convention across all components + libraries (i.e. |
It would make it harder to override styles of components from just one package using plain CSS. I'm not sure if it's a sensible use case (i.e. having both Material UI and Base inputs in the same application).
Yes, but if you have Material components and styled
Yes, I agree - that's why we need a way to customize or disable the generation of class names in Base components. To summarize: I feel like having prefixes for each product would work best. So |
We had a chat with @michaldudak, we have found the following dimensions that seem important to optimize for in the tradeoff:
Yeah, not sure we should optimize for this too much, I would be curious to see what we gain in exchange on giving up on this. |
@mui/core, I've created a poll to settle this finally: #34069. @oliviertassinari's edit: While this is about the CSS class name. We might also want to consider the impact for overrides in A.
|
Current behavior 😯
As I've been documenting the component slots and their classes in the MUI Base docs (#33156), I've noticed that the format for class names is inconsistent across the components. Variations on the theme include:
MuiOptionUnstyled-root
https://mui.com/base/react-select/#anatomyBaseBadge-root
https://mui.com/base/react-badge/#anatomyMuiSwitch-root
https://mui.com/base/react-switch/#anatomyExpected behavior 🤔
I would expect these names to all have the same format.
Personally, I think it should be something like
MuiBaseComponentName
, e.g.MuiBaseButtonUnstyled
,MuiBaseTrapFocus
.The text was updated successfully, but these errors were encountered: