I'm using the React Material UI's Select Component. I wish to remove or speeden the animation that comes when the menu is opening. I tried something like: Solution 1:
add this to your stylesheet:.MuiMenu-paper {
transition-duration: 0s!important;
}
CopyThis basically overrides the transition duration of the select dropdown and sets it to 0 seconds.You can also change the duration according to what you like (make it faster). The default animation duration is:transition-duration: 251ms, 167ms;
CopySolution 2:
The reason why it doesn't work: MUI <Select /> API don't have props TransitionComponent, as well as some other components like <Tooltip /> do haveRefer: API document ofMUI TooltipMUI SelectRelated QA: React Material UI Tooltips Disable Animation SolutionOverride the transition style would be fine.div.MuiPaper-root {
transition: none !important;
}
Copy ExplanationThe HTML structure for options:Since it's been dynamically generated outside the main component, it's not suitable for us to directly set styles for them.However, we can optionally override the styles by those classNames like MuiPaper-root, or some other ways like a given id.<divclass="MuiPaper-root MuiMenu-paper MuiPopover-paper MuiPaper-elevation8 MuiPaper-rounded"tabindex="-1"style="opacity: 1; transform: none; min-width: 40px; transition: opacity 251ms cubic-bezier(0.4, 0, 0.2, 1) 0ms, transform 167ms cubic-bezier(0.4, 0, 0.2, 1) 0ms; top: 16px; left: 16px; transform-origin: -8px 7.7px;"
><ulclass="MuiList-root MuiMenu-list MuiList-padding"role="listbox"tabindex="-1"
>
...
</ul></div>;
CopySolution 3:
For those that are using a corresponding Material UI InputLabel component with a mui Select component, I was able to pass in the following props to the InputLabel component to disable the animation and shrink altogether:<div><FormControl><InputLabeldisableAnimation={true}shrink={false}...
>
{`some label`}
</InputLabel><Select>
{`...`}
</Select></FormControl></div>CopyMUI Input Label APISolution 4:
To add to keikai's answer, you can also do this globally with a theme change:consttheme=createMuiTheme({overrides: {
MuiPaper: {
root: {
transition:'none !important'
},
},
}
});Copy
Share
Post a Comment
for "React How To Remove The Animation Of Material-ui Select"
Top Question
Function To Be Called Once Div Hits Top Of Viewport Window
Wondering if you could have a look at the below code. Im wa…
Webrtc Video Constraints Not Working
I'm trying to get a lower resolution from the webcam na…
Multiple Flexboxes With Margin-right, Except The Last One In The Row? Without JS?
See the following image: Current setup is at top-left. If …
Problem In Getting Right Result For Select Box
i am using Jquery as: $(document).ready(function(){ test(&…
IE7 Is Clipping My Text. How Do I Adjust Its Attitude?
A few days ago I re-skinned my website. Development of this…
@font-face Behavior Inconsistencies Inside Of @media Query Rules (ie9)
The current behavior in Chrome, Firefox and Safari when it …
Only Let Certain Inner Divs Control Outer Div's Width
I have the follow html structure: …
Transparency Of A Filled Stroke In HTML5
I'm working on a doodling app in HTML5 and I would like…
Click Ignored: Issue With Label Elements To Associate With Form Controls
I have associated the label element to form fields using &#…
How Do I Search Nested Divs Using Regex For Class Names
I want to search for nested divs like these in my DOM …
November 2024
(35)
October 2024
(36)
September 2024
(10)
August 2024
(214)
July 2024
(190)
June 2024
(407)
May 2024
(690)
April 2024
(441)
March 2024
(796)
February 2024
(817)
January 2024
(803)
December 2023
(837)
November 2023
(355)
October 2023
(585)
September 2023
(264)
August 2023
(321)
July 2023
(262)
June 2023
(350)
May 2023
(210)
April 2023
(146)
March 2023
(139)
February 2023
(178)
January 2023
(257)
December 2022
(130)
November 2022
(157)
October 2022
(181)
September 2022
(162)
August 2022
(298)
July 2022
(90)
Menu Halaman Statis
Beranda
© 2022 - Html5 Manual