Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

200
Views
ReactJS : Writting a style in createStyle method

Through edge developer tools , I have adjusted below style -

enter image description here

I want .MuiAccordion-root.Mui-expanded to be with margin 2px. By default its 16px So I written below style in react where I have used accordion -

createStyles({
root : {
"& .MuiAccordion-root.Mui-expanded":{
margin : "2px 0"
}
}
})

After setting this, when I refresh my page , I dont see this style has got applied. I again see default style with margin 16px.

How can I write style so that it could take margin 2px ?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Personnally I do it via a styles.module.scss file

import styles from './styles.module.scss';

<Accordion className={styles.accordion}>
  <AccordionSummary
    expandIcon={<ExpandMoreIcon />}
    aria-controls="panel1a-content"
    id="panel1a-header"
  >
    <Typography>Accordion 1</Typography>
  </AccordionSummary>
  <AccordionDetails>
    <Typography>
      Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse
      malesuada lacus ex, sit amet blandit leo lobortis eget.
    </Typography>
  </AccordionDetails>
</Accordion>
.accordion {
  :global(.Mui-expanded) {
    margin: 2px 0;
  }
}

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!