Implement CSS transitions for opening and closing modals
masterYou can implement fade transitions for the modal overlay by using specific CSS classes. To apply a global fade transition to all modals, add the following CSS to your project:
.ReactModal__Overlay {
opacity: 0;
transition: opacity 2000ms ease-in-out;
}
.ReactModal__Overlay--after-open {
opacity: 1;
}
.ReactModal__Overlay--before-close {
opacity: 0;
}To apply transitions to a specific modal only, define custom class names in your CSS and pass them to the className prop of the <Modal /> component as an object.
.ReactModal__Overlay {
opacity: 0;
transition: opacity 2000ms ease-in-out;
}
.ReactModal__Overlay--after-open{
opacity: 1;
}
.ReactModal__Overlay--before-close{
opacity: 0;
}