question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[ExpansionPanel] Cannot override margins with 'classes' prop

See original GitHub issue

I 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)

Codesandbox example

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.

expansionpanel-root

expansionpanel-content

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:closed
  • Created 5 years ago
  • Comments:13 (9 by maintainers)

github_iconTop GitHub Comments

3reactions
oliviertassinaricommented, Feb 14, 2019
1reaction
adam-nielsencommented, May 8, 2018

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 error Could 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 that expanded 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 for dollar and $ don’t bring anything up.

Thanks again for your help!

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found