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

172
Views
How To Disable Grid and its children in React js MUI

I Want to Disable Grid (MUI Component) (and its Children) in React js .

and also , I Want to know how to Disable any Container and it's items in React js! (No matter what kind of children it has)

ex:

 <Grid
       item
       disabled  //And any other options
       xs={12}
       md={6}
       spacing={1}
       style={{ padding: '5px' }}>
       <CmpDateTimePicker
         label="from"
         value={this.props.from_timestamp}
         onChange={(from_timestamp) => 
             this.props.OnFromPeriodChanged(from_timestamp)}
         dir={dir}
         intl={intl}
         preSelect={lastMonthDate}
         />
  </Grid>

Thanks for your Help! :)

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

0

The disabled prop is not available on every MUI component, but instead you can conditionally render a component by using a simple if statement or ternary operator.

Since you give no context for the above code, I can't directly give you an example, but I can give examples for the two cases I spoke about above.

You can use an if statement like:

if(<conditional>){
 return <Grid>...</Grid>
}

return <div></div>

With this code your component will only render what is in the if statement when your conditional is true.

Another way is to use a ternary:

return (
 <div>
   {<conditional>?<Grid>
   ...
   </Grid>:""}
 </div>
)

You can use this inside of jsx to only conditionally render a certain component.

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!