-
-
Notifications
You must be signed in to change notification settings - Fork 31.7k
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-ui] Change the CSS class prefix to base-
#40205
Conversation
Netlify deploy preview
@material-ui/unstyled: parsed: -0.04% 😍, gzip: +0.25% Bundle size reportDetails of bundle changes (Toolpad) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I realized material-ui-next had an old implementation of the Input (based on the Base UI's Input component), with failing tests after my changes. I removed the component (we can add one using hooks in the future).
baseui-
base-
01be4bd
to
0b1697b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We'll need to also update the base-theme.css
file.
@@ -39,7 +39,7 @@ Notice that the second button cannot be clicked due to the `disabled` prop: | |||
The Button component is composed of a root `<button>` slot with no interior slots: | |||
|
|||
```html | |||
<button class="MuiButton-root"> | |||
<button class="base-Button-root"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a personal preference, but I would rather write BaseButton-root
, than base-Button-root
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the plan for Material UI class names, change them to .mui-Button-root
? If we don't plan to change it,
.BaseButton-root
looks like a clear direction to take. It's arbitrary, so we might as well be consistent before we make it stable.
Edit: moved to #39467 (comment)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We're considering dropping the slot classes at all: https://www.notion.so/mui-org/base-ui-Style-hooks-e943c3051ca74ce79f2e5af98a0f43eb
Not unless we include the CSS file only on the gallery page. Otherwise, all Base UI components on the docs would be affected. |
@michaldudak This seems to cause
in X https://app.circleci.com/pipelines/github/mui/mui-x/51253/workflows/90888eb7-3a25-443c-9b4f-e0ebe1c44dfd/jobs/293619 |
The fix for this is here: mui/mui-x#11671. Alex gave me green light to merge it. |
Ok, got caught in the crossfire. Will have to wait until mui/mui-x#11671 is merged then 🙂 |
Looking at the release v5.15.5, it appears the class prefix of Base UI components have been changed from Mui- to base-. Apologies, but found it confusing, would it affect the projects using "mui" (and not "base-ui" directly) as well? I'm using below mui packages in my code and not using the @mui/base directly
I tried to update my code with using the base- classes but that seems not working.
|
No, this change only affects projects using Base UI components. Nothing should change in Material UI. |
Changed the class prefix of Base UI components from
Mui-
tobase-
to allow styling Base UI apps with plain CSS and avoid conflicts with Material UI components.Also, I changed the pattern a bit:
the root element doesn't have the(reverted)-root
postfix anymore, what makes the class name shorter and still readable (so, for example, there's nobaseui-Button-root
, butbaseui-Button
)base--{state}
pattern (somewhat akin to BEM) to differentiate them from component classes visuallyBreaking change
This change only affects codebases that use class names verbatim (i.e., not exposed by JS object such as
buttonClasses
, but as plain strings or in CSS stylesheets (.MuiButton-root
))To adapt your code to the new pattern:
.Mui([A-Z][A-Za-z]*)-
with.base-$1-
(soMuiButton-root
becomesbase-Button-root
, etc.),.Mui-([a-z]*)
with.base--$1
(soMui-disabled
becomesbase--disabled
, etc.).Closes #39467