Replies: 3 comments 8 replies
|
You have two options: <AppBar
sx={{
...appBarStyles,
...(open && appBarShiftStyles),
}}
>const StyledAppBar = styled(AppBar, {
shouldForwardProp: prop => prop !== 'open' // don't forward this prop to the AppBar
})(({ open ) => ({
...appBarStyles,
...(open && appBarShiftStyles),
}))
<AppBar
open={open}
> |
|
I am really confused by what is legacy and what is now recommended. https://mui.com/styles/basics/ states that: "@mui/styles is the legacy styling solution for MUI. It is deprecated in v5." Is the styled-components system deprecated, or not? In other words, should I be doing: or is this the legacy solution? If this is the legacy solution, then how do I achieve reuse of style components? This link: https://mui.com/styles/basics/#styled-components-api makes me think that |
|
However, the page https://mui.com/system/styled/ appears under "System -> styled", making me think it's not deprecated (?), or is it? But the same Guidance would be appreciated. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Help for migrating withStyles to styled()
I have a case where I want to rewrite my styling from a previous project that used Material-UI v4 to MUI v5.
Since I saw in MUI v5 using styled api instead of makeStyles to do custom styling, I decided to give it a try.
Everything went smoothly until I found one problem for me.
In a previous project, I used
clsxandconditional renderingto set the className when a state is true. Like the code snippet I included belowI'm confused how this concept is implemented in MUI v5 using the styled api. Does anyone know how? Thank you in advance
All reactions