Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to disable Material UI expansion panel's animation?

I want to disable the animation of Material UI expansion panel in React. How can I disable all the animations applied to the expansion panel?

Tried overwriting the transitions but it didn't help. Let me know how you would overwrite that.

PS: If that is not possible let me know any other light weight expansion panel (accordion) to use with styling customization.

like image 631
Shah Lav Avatar asked Mar 29 '19 19:03

Shah Lav


People also ask

How do you turn off the mat accordion?

To disable the panel, add the disabled directive to the panel element and set it to true. To enabled it, set it to false. We can also group multiple panels by using the mat-accordion element.


1 Answers

Yes. You can do this by manipulating the TransitionProps prop, as such:

  <ExpansionPanel
    defaultExpanded
    square
    TransitionProps={{
      timeout: 0
    }}
  >

The timeout: 0 prop can be discovered by looking at the Collapse API, which is the default TransitionComponent of ExpansionPanel: https://material-ui.com/api/collapse/

like image 156
Sterling Bourne Avatar answered Sep 30 '22 14:09

Sterling Bourne