Material-UI ExpansionPanelSummary expanded class


Material-UI ExpansionPanelSummary expanded class



In the documentation for Material-UI ExpansionPanelSummary there are several class override names where expanded is one of them.
Could someone explain why it is not possible to use the following code to set the size of the root as well as expanded state?


<ExpansionPanelSummary classes={{ root: { midWidth: 30}, expanded: { minWidth: 30} }}>
foo bar
</ExpansionPanelSummary>




1 Answer
1



you need to follow the styles overriding methods as the material-ui suggested.



please find methods from here: https://material-ui.com/customization/overrides/



here I used classes overriding using withStyles from material ui


const styles = theme => ({
root: {
minWidth: 300
},
heading: {
fontSize: theme.typography.pxToRem(15),
fontWeight: theme.typography.fontWeightRegular
},
expanded: { minWidth: 30, backgroundColor: "red" }
});

function SimpleExpansionPanel(props) {
const { classes } = props;
return (



}
classes={{ root: classes.root, expanded: classes.expanded }}
>
Expansion Panel 1



Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse
malesuada lacus ex, sit amet blandit leo lobortis eget.




);
}

export default withStyles(styles)(SimpleExpansionPanel);



find the working example from here: https://codesandbox.io/s/zl4141wm44



I have added expanded and root as you suggested but you can use the other properties as well.(changed the background color in expanded to understand it correctly)





Thanks, I see now that my example was really bad
– Niklas Fondberg
Jul 3 at 7:00





@NiklasFondberg can you please pick this as the correct answer.
– gluttony
Jul 3 at 8:05






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

api-platform.com Unable to generate an IRI for the item of type

How to set up datasource with Spring for HikariCP?

Display dokan vendor name on Woocommerce single product pages