Using the Box
component with the clone
attribute has inconsistent styling in production vs dev
#21038
Closed
2 tasks done
Labels
duplicate
This issue or pull request already exists
The resulting styles when using the
Box
component with theclone
attribute are created differently in production than they are in development mode.Ideally the
Box
component would be able to override styles in production mode like it does in development, but at the very least it should be the same in both modes.With the current limbo of jss and possible conversion to a different css-in-js library (#16947) I have been trying to use the
Box
component as much as possible to reduce the amount of change needed if material-ui decides to change. So it would be best if theBox
component was able to override original styles, and behave consistently between environments.Seems related to #16609 , but that was already closed.
Current Behavior 😯
The resulting styles are created differently in production than they are in development mode, with the production mode not allowing the
Box
component using theclone
attribute to override already defined styles likebackground-color
.Production: Card has white background
Development: Card has Purple Background
Expected Behavior 🤔
It should work the same in production as it does in develop, with the
<Box clone bgcolor="primary.main">
overriding the child component<Card>
's (or any other material component's) original styles.Production: Card has Purple Background
Development: Card has Purple Background
Steps to Reproduce 🕹
Steps:
Box
component with the clone attribute to override a style on a material-ui component like theCard
.bgcolor
which is already defined on the child component.Code:
Dev Output:
Prod Output:
Here you can see the dev build: https://codesandbox.io/s/quizzical-dew-fi3qw
Here you can see the prod build: http://codyschaaf.com/box-demo/
(prod repo: https://github.com/CodySchaaf/box-demo)
Context 🔦
I'm trying to rely more on the
Box
component instead ofmakeStyles
because of the uncertain future ofjss
. Also I'm starting to prefer the ease of use that comes with theBox
component and its helper shortcuts. But when trying to add styles to existing components it isn't always consistent in its behavior.Your Environment 🌎
The text was updated successfully, but these errors were encountered: