Is it possible to change show animation of dialog in material-ui for react using css? I'm not advanced in css but I know that there exists something like transtion and transform.
Customized Dialogs We can create our own dialog components by putting into our own components and passing in various styles to it. We create a styles function that we pass into the withStyles higher-order components with various styles. We moved the close button by setting some styles for the closeButton class.
You just need to add fullScreen flag to modal component in order to achieve full screen. And if you don't want to use fullScreen, simply remove that fullScreen flag and don't need to use CSS here.
12/2021 UPDATE:
The answer below was written for an early release of material-ui v1 and is ancient history. With material-ui version 5, the concept is basically the same and the current Dialog Demo shows how this can be accomplished.
Import the transition you want, but you need to use React.forwardRef
because the transition expects to receive a ref
(more on that in the React Docs):
import Slide from '@mui/material/Slide';
const Transition = React.forwardRef(function Transition(props, ref) {
return <Slide direction="up" ref={ref} {...props} />;
});
Then:
<Dialog
open={open}
TransitionComponent={Transition}
keepMounted
onClose={handleClose}
aria-describedby="alert-dialog-slide-description"
>
Original Material-UI V1 Answer:
The Dialog component exposes a transition prop that can be used to override the default. There is an example in the Dialog demo (labeled Slide in Alert Dialog) that uses their provided Slide transition:
import Slide from 'material-ui/transitions/Slide';
Then:
<Dialog open={this.state.open} transition={Slide} onRequestClose={this.handleRequestClose}>
Here are the transition components they provide:
If none of these serve your purpose, you can use them as a starting point for creating your own Transition component.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With