-
-
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
[docs] Inconsistent documentation about importing "styled" #43944
Comments
Hi, this migration guide is intended to be done step by step. The step: https://v5.mui.com/material-ui/migration/migrating-from-jss/ will finally guide you to using styled from '@mui/material/styles' as this is the Emotion implementation. To specifically answer your questions:
For using Emotion, you should use @mui/material/styles
You can still use styled in v6, you can even still use Emotion (this is the production ready implementation
Piigment CSS is still not stable, it is intended for people who want to give it an early try and provide feedback, it is not production ready. This is why Emotion is still the default and recommended styling engine. We are not going to be moving away from the styled() API for now, my only recommendation would be to use the I hope this explanation helped, let me know if you have more questions. |
thank you for providing the information. Since styled from mui/material/styled will be not deprecated in the future then this conversation can be closed. Anyhow I understand migration guide is done step by step and documentation was gradually updated i still think that suggestion about importing styled imported from mui/styles (https://v5.mui.com/material-ui/migration/v5-style-changes/#styled ) should be corrected. If I remember, from begging of mui5 mui/styles was marked as deprecated so there is no need to be part of documentation. |
The idea was you can finish the migration to v5 and still use JSS for your custom style overrides. Then, if you decide to go completely to Emotion, you can follow the next guides :) |
I will let @samuelsycamore to decide on the best course of action, I am fine with leaving it as is. |
We've heard this feedback a few times now—it's understandably confusing if you're jumping around to find a solution and not necessarily reading the migration doc from start to finish. I think this is one of the main culprits that's contributing to the confusion:
I think this could be rephrased to explicitly state here that this is a temporary solution while you're in the process of migrating your app away from this deprecated package altogether. Something like this:
Is that more clear? |
This issue has been closed. If you have a similar problem but not exactly the same, please open a new issue. Note @Paki90 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. |
Related page
https://v5.mui.com/material-ui/migration/v5-style-changes/#styled
Kind of issue
Unclear explanations
Issue description
Currently we are still using mui5 and planning to do migration to mui6. What I personally noticed that there is been inconsistency in the documentation about using styled in the documentation for migration from 4 to 5th version.
https://v5.mui.com/material-ui/migration/v5-style-changes/#styled
import { styled } from '@mui/styles';
here is suggested that styled should be imported from mui/styles
https://v5.mui.com/system/styles/basics/
here is clearly written that mui/styles are deprecated and it must be use mui/system instead
https://v5.mui.com/system/styled/
import { styled } from '@mui/system';
here is suggested that styled should be imported from mui/system
https://v5.mui.com/material-ui/migration/troubleshooting/#typeerror-cannot-read-properties-of-undefined-reading-pxtorem
https://v5.mui.com/material-ui/migration/migrating-from-jss/#1-use-styled-or-sx-api
import { styled } from '@mui/material/styles';
here are examples where is suggested that styled should be imported from mui/material/styles
In our solution: styled, theme, useTheme, SxProps are imported from mui/material/styles (if you think one of these should not be part of mui/material/styles, let me know) . Here are examples how it is used:
We do not use any import from mui/system and default styling engine Emotion is not in use even it has dependencies and required to be installed.
Context
There are certain things to declare before we migrate to mui6:
Does it mean that we should go directly to Pigment CSS? What would be the best tool to have migration from styled to Pigment CSS? Appreciate for any help
Search keywords: styled, mui5, mui6, import styled
The text was updated successfully, but these errors were encountered: