[ExpansionPanel] Cannot override margins with 'classes' prop
See original GitHub issueI am trying to make the expanded summary area of the ExpansionPanel much thinner, but I have found that the necessary styles cannot be overridden as normal. It seems that a more specific CSS class is used, which always overrides anything you specify.
- I have searched the issues of this repository and believe that this is not a duplicate.
Expected Behavior
The margin
and min-height
CSS values should apply to the element.
Current Behavior
Regardless of what you specify, margin
is always 20px 0
and min-height
is always 64px
.
Steps to Reproduce (for bugs)
const styles = theme => ({
expanded: {
backgroundColor: 'red',
minHeight: 0,
marginTop: 0,
marginBottom: 0,
},
});
<ExpansionPanelSummary classes={{expanded: classes.expanded}}>
backgroundColor
gets applied to the expanded summary area, but the other listed CSS attributes get overridden.
Context
I am trying to make the expanded summary area the same size as the compressed area, and both of them smaller than the default (by removing the padding).
Your Environment
Tech | Version |
---|---|
Material-UI | 1.0.0-beta.44 |
browser | Firefox and Chrome |
Issue Analytics
- State:
- Created 5 years ago
- Comments:13 (9 by maintainers)
Top Results From Across the Web
[ExpansionPanel] Cannot override margins with 'classes' prop
I am trying to make the expanded summary area of the ExpansionPanel much thinner, but I have found that the necessary styles cannot...
Read more >customizing the expansionpanel in material ui and overwriting ...
There is a way to override the defaults in your own style classes: root: { '& .Mui-expanded': { minHeight: 0, }, width ...
Read more >v-text-field API - Vuetify
name type default
#append‑icon string undefined
#append‑outer‑icon string undefined
#autofocus boolean false
Read more >Spacing · Bootstrap v5.2
Assign responsive-friendly margin or padding values to an element or a subset of its sides with shorthand classes. Includes support for individual properties, ......
Read more >AccordionSummary API - Material UI - MUI
Learn about the props, CSS, and other APIs of this exported module. ... classes, object. Override or extend the styles applied to the...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@felipezacani Are you saying that https://material-ui.com/demos/expansion-panels/#customized-expansion-panel doesn’t help?
Ah right, sorry I didn’t notice Codesandbox had a console! @kof Might I humbly suggest changing
%s
to"%s"
in the warning? If I had seen the errorCould not find the referenced rule expanded in xxx
I would be looking in the wrong place for something being expanded, I wouldn’t have realised thatexpanded
was actually the name of the problematic rule!Thanks also @oliviertassinari for the explanation of what
$
is for. I have looked through the JSS docs but still haven’t found where its purpose is explained! Are there any docs that go into more detail? Maybe I’m just looking for the wrong terms - searching fordollar
and$
don’t bring anything up.Thanks again for your help!